Assignment 1 Problem 1 (7) (TypeError: 'float' object cannot be interpreted as an integer)

Hi everyone!

I am trying to use range in my if else blocks, however, I am getting the error below. Can any of you suggest why this is happening and suggest a solution?

TypeError Traceback (most recent call last)
1 if my_BMI < 18.5:
2 print (my_name + " is underweight")
----> 3 elif my_BMI in range (18.5,25):
4 print (my_name + " is normal")
5 elif my_BMI in range(25,30):

TypeError: ‘float’ object cannot be interpreted as an integer


Hi @arunsathyaseelan.p,
As per python documentation, range accepts only int values as arguments.


Understood, thanks @Ishvinder!