I want to make a for loop that looks like this:
for x in range(0, 1, 0.1):
print(x)
obviously it throws this error:
Traceback (most recent call last): File "", line 1, in for i in range(0, 1, 0.1): TypeError: 'float' object cannot be interpreted as an integer
So it there a way in python 3.6 to make a for loop with floating point?
use numpy
's arange instead of range:
import numpy as np
for x in np.arange(0, 1, 0.1):
print(x)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With