python-algorithm

백준 6825 Body Mass Index

무적김두칠 2022. 12. 22. 16:31

https://www.acmicpc.net/problem/6825

 

6825번: Body Mass Index

The Body Mass Index (BMI) is one of the calculations used by doctors to assess an adult’s health. The doctor measures the patient’s height (in metres) and weight (in kilograms), then calculates the BMI using the formula BMI = weight/(height × height).

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
def sol(weight, height):
    bmi = weight/(height**2)
    if bmi>25:
        return 'Overweight'
    elif bmi>=18.5:
        return 'Normal weight'
    else:
        return 'Underweight'
 
if __name__ == '__main__':
    weight = float(input())
    height = float(input())
    print(sol(weight, height))
 
cs
반응형