BMI calculator code project | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

BMI calculator code project

-------------------------------------------------- For BMI calculator code project: -------------------------------------------------- weight=float(input()) height=float(input()) BMI=weight/height**2 if BMI<18.5: print("Underweight") if BMI>=18.5 and BMI<25: print("Normal") if BMI>=25 and BMI<30: print("Overweight") if BMI>=30: print("Obesity") ----------------------------------------------- Do not use the else statement! ----------------------------------------------- https://code.sololearn.com/cWKLRSwUymM5/?ref=app

5th Feb 2023, 12:43 AM
Faisal Zerhouni | 50 • أ
Faisal Zerhouni | 50 • أ - avatar
9 Answers
5th Feb 2023, 3:44 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
My implementatiom without else statememt: bmi=int(input())/float(input())**2 result={30: 'Obesity', 25: 'Overweight', 18.5: 'Normal', 0: 'Underweight'} for i in result.keys(): if bmi>i: print(result[i]) break
5th Feb 2023, 4:21 AM
Mateusz Kempa
Mateusz Kempa - avatar
5th Feb 2023, 8:30 PM
Faisal Zerhouni | 50 • أ
Faisal Zerhouni | 50 • أ - avatar
+ 1
Thank you Mateusz
5th Feb 2023, 9:22 PM
Faisal Zerhouni | 50 • أ
Faisal Zerhouni | 50 • أ - avatar
+ 1
weight=float(input()) height=float(input()) BMI=weight/height**2 if 0<=BMI and BMI<18.5: print("Underweight") elif BMI>=18.5 and BMI<25: print("Normal") elif BMI>=25 and BMI<30 : print ("Overweight") else: print("Obesity")
6th Feb 2023, 7:34 AM
Avi Kumar
Avi Kumar - avatar
+ 1
Basudab De Only illuminatis know...
6th Feb 2023, 5:11 PM
Mateusz Kempa
Mateusz Kempa - avatar
+ 1
Mateusz 😂😂
6th Feb 2023, 7:25 PM
Faisal Zerhouni | 50 • أ
Faisal Zerhouni | 50 • أ - avatar
0
You probably want to post it in code section. Go to "Create" -> "Code". If you manage to do it and stop spamming I'll even upvote your code.
5th Feb 2023, 8:55 PM
Mateusz Kempa
Mateusz Kempa - avatar
0
How to make a triangle
6th Feb 2023, 4:33 PM
Basudab De
Basudab De - avatar