+ 1
Help pls i don't know what is the problem
Weight=input() height=input() X=int(Weight)/int(height)**2 if X<18.5: print("Underweight") if 18.5<=X<25: print("Normal") if 25<=X<30: print("Overweight") if 30<=X: print("Obesity")
5 Antworten
+ 2
Ryad Âhméd
Convert inputs to float not int
+ 5
Ryad Âhméd ,
this seems to be a in-lesson code coach. if you really have a problem, we need some more details from you:
▪︎give a clear and complete description about your task
▪︎if there are error messages please post them here
thanks for your understanding!
+ 4
Ryad Âhméd ,
the input of the height value can be like 1.9 (1 meter and 90 cm). if you convert this to int the result will be 1. it will also be 1 if input is 1.5.
+ 2
It worked but why float not int? A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟
+ 1
Ryad Âhméd
Because height is in decimal so when you take input in python then your input is by default String like '1.85' so you can't convert in int
Try this in Code Playground:
print(int('1.95'))