I keep getting this error for my simple python program: “TypeError: 'float' object cannot be interpreted as an integer”

792    Asked by HarryButler in Python , Asked on Feb 25, 2021
Answered by Harry Butler

You can use the below-mentioned code for that:-

for i in range(c/10):

You're creating a float as a result - to fix this use the int division operator:

for i in range(c // 10):



Your Answer

Interviews

Parent Categories