+ 1
What is the problem in this code
Although there are no errors but all the test cases are not cleared https://code.sololearn.com/cyp1PfSx2yH0/?ref=app
3 Answers
+ 3
calc() should return
wei / ( hei ** 2 )
Or
wei / ( hei * hei )
Your code raised <hei> by itself where it should raise <hei> by 2 or multiply <hei> by itself.
+ 3
Ipang Thanks
+ 1
def calc(wei,hei):
return wei/(hei**hei)
def dis(bmi):
if bmi<18.5 :
print ("Underweight")
elif bmi >= 18.5 and bmi<25:
print ("Normal")
elif bmi>=25 and bmi<30:
print ("Overweight ")
elif bmi >= 30:
print ("Obesity")
#wei = 8l
#hei= 1.9
wei = int (input())
hei = float (input())
b= calc (wei,hei)
dis(b)