+ 1

Help me to carecter this python code

weight = int(input("enter your weight :")) height = float(input("enter your height :")) ans = float(weight/(height ** 2)) if(ans < 18.5): print("Underweight") elif (ans == 18.5 && ans < 25): print("Normal") elif (and == 25 && ans < 30): print("Overweight") elif (ans >= 30) print("Obesity")

24th May 2022, 9:56 AM
RTB
RTB - avatar
2 Answers
+ 8
RTB Python does not use && Python does use and
24th May 2022, 10:04 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 6
RTB , -> check your code for correct indentation -> check for missing colon after 'elif: -> also check all conditiins like '... ans == 18.5...'. (comparison operator). read the task description carefully and follow it btw: -> we do not need parenthesis when using 'if' or 'elif' -> if you are going to use your code for code coach, no user prompt in input() function is accepted
24th May 2022, 10:25 AM
Lothar
Lothar - avatar