+ 1

Help please!

hi! I am trying to do an easy BMI calculator but there is an error which I can't find. Someone helps me pls https://code.sololearn.com/cx4a9JmoBCbc/?ref=app

16th Jul 2021, 8:19 AM
Andrea
5 Respuestas
+ 7
Also, you have the formula backwards. It should be bmi = weight_kg / (height_m * height_m)
16th Jul 2021, 8:41 AM
David Ashton
David Ashton - avatar
+ 6
Python is case-sensitive, so don't capitalize 'if' and 'else' 🙂
16th Jul 2021, 8:35 AM
David Ashton
David Ashton - avatar
+ 3
You might also want to change line 6 to print('bmi:', bmi)
16th Jul 2021, 8:37 AM
David Ashton
David Ashton - avatar
+ 2
David Ashton thx for the help, it now works properly. Thanks also for the like! 🙂
16th Jul 2021, 8:48 AM
Andrea
+ 2
If you're getting too many decimal places, you can round it to, say, 3 places using the round() function. print('bmi:', round(bmi, 3))
16th Jul 2021, 9:18 AM
David Ashton
David Ashton - avatar