Quick actions

cmd+k|ctrl+k

Navigation

Languages

BMI exercise

Snippet info

Language

Python

Visibility

public

Author

tonyngswell

Created

2026-05-21T13:03:07.849959Z

Updated

2026-05-21T13:15:00.741197Z

#https://glot.io/snippets/hc752x5aob
w = input("Please input your weight (kg) ")
h = input("please input your height (cm)")
if w=='' or h=='':
    print("either your weight, height or both has not yet inputed !")
elif w.isdigit()==False or h.isdigit() == False:
    print("wrong input")
else :
    w = float(w)
    h = float(h)/100
    bmi =  round(w/(h**2),2)
    if bmi <18.5:
        note = 'you are under weightd'
    elif bmi >= 18.5 and bmi <=25:
        note = 'you are fit'
    else:
        note = 'you are over-wighted'
    print(f'Your BMI : {bmi}, {note}')    
INFO