관리 메뉴

솜씨좋은장씨

[BaekJoon] 6825번 : Body Mass Index (Python) 본문

Programming/코딩 1일 1문제

[BaekJoon] 6825번 : Body Mass Index (Python)

솜씨좋은장씨 2022. 12. 29. 19:57
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 Body Mass Index 입니다.

 

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

👨🏻‍💻 코드 ( Solution )

def get_bmi(weight, height):
    return weight / (height * height)


def body_mass_index(weight, height):
    check_result = ""
    
    bmi = get_bmi(
        weight=weight, height=height
    )
    
    if bmi < 18.5:
        check_result = "Underweight"
    elif 18.5 <= bmi < 25:
        check_result = "Normal weight"
    elif bmi >= 25:
        check_result = "Overweight"
        
    return check_result


if __name__ == "__main__":
    weight = float(input())
    height = float(input())
    
    print(body_mass_index(weight=weight, height=height))
 

GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07

1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.

github.com

Comments