0

Hi, can someone help me with a python code please?

I'm doing "python for begginers" and I have to do an IMC calculator, I'm having some problems with the code and I don't know how to solve them, can someone help me? btw sorry if there's any wrong word or something my English is so poor. Thanks

19th Aug 2021, 4:45 PM
Manel
9 Answers
+ 4
Suppose you get a bmi of 24.99. This case is not covered by the code yet. I would recommend you use < 25 instead of <= 24.9 and so forth
19th Aug 2021, 5:00 PM
Lisa
Lisa - avatar
+ 2
Please put your code in a playground script and link it here!
19th Aug 2021, 4:50 PM
Lisa
Lisa - avatar
+ 2
What did you input? imc = weight/ tall**2 As you renamed the variables Line 5: imc (not IMC) And if you have <= 25 and >= 25 the number 25 is covered twice
19th Aug 2021, 5:41 PM
Lisa
Lisa - avatar
+ 1
Your "else if" should be "elif" in python. Also don't cast z to integer
19th Aug 2021, 5:20 PM
Lisa
Lisa - avatar
0
Hi, I did it but it doesn't work It says "invalid literal for int() with base 10:" what does it mean? Sorry if I'm a bore
19th Aug 2021, 5:16 PM
Manel
- 1
It says me the same, "in line 1 <module> weight=int(input()) evalue error: invalid literal for int() with base 10:" I don't know what does it mean
19th Aug 2021, 5:33 PM
Manel
- 1
You want a normal calculator?
20th Aug 2021, 9:25 AM
MoX
- 1
weight=float(input()) height=float(input()) BMI=weight/(height**2) if 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")
20th Aug 2021, 9:07 PM
Sheriff Gaye
Sheriff Gaye - avatar