0
Am getting an error so how can I owed come that can anyone help me
Link to view my codes https://code.sololearn.com/cnR7z389GBt6/?ref=app
7 odpowiedzi
+ 2
looks like you have multiple inputs. in sololearn, you need to enter all your inputs in the one input box separated by a new line.
example input:
20
80
+ 1
Hi STEVE!
It's working without any errors. Are you sure that you're getting errors?
Please double check you linked correct code in description
+ 1
Maybe input eg 1,80 instead of 1.80
0
Yes there is an error for me like when we give an output it and runs it shows an error
0
Yes
0
Can you tell us what are the inputs you tried to give?
For me, it prints Normal for weight = 60 and height = 1.80
0
STEVE SONY The bug is in the last 'else' clause; the value '30' is left out. Try using the '>=' operator instead of the greater than operator. Here's how you can shorten your code:
if x >= 30: print("Obese")
elif x >= 25: print("Overweight")
elif x >= 18.5: print("Normal")
else: print("Underweight")
Or just:
print("Obese" * (x >= 30) or "Overweight" * (x >= 25) or "Normal" * (x >= 18.5) or "Underweight")
# I hope that this answer helps you with your query. Happy coding!