The “TypeError: ‘float’ object cannot be interpreted as an integer” error is raised when you try to use a floating-point number in a place where only an integer is accepted.
This error is common when you try to use a floating-point number in a range() statement.
The range function does not work with floats. Only integer values can be specified as the start, stop, and step arguments. But you can use this in a different way. I have attached one example for your reference.
def range_with_floats(start, stop, step):
while stop > start:
start += step
for i in range_with_floats(0.1, 0.5, 0.1):
I hope this will help you.