+ 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")

8th Aug 2021, 1:27 PM
Ryad Âhméd
5 Antworten
+ 2
Ryad Âhméd Convert inputs to float not int
8th Aug 2021, 1:33 PM
A͢J
A͢J - avatar
+ 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!
8th Aug 2021, 1:30 PM
Lothar
Lothar - avatar
+ 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.
8th Aug 2021, 1:43 PM
Lothar
Lothar - avatar
+ 2
It worked but why float not int? A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟
8th Aug 2021, 1:38 PM
Ryad Âhméd
+ 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'))
8th Aug 2021, 1:47 PM
A͢J
A͢J - avatar