for i in range(1, 10, 2):#use (start,end,step)
print(i)
this program prints out odd numbers from 1-10.
However if I want to jump half a unit at a time (e.g. 1, 1.5, 2, …), you cannot use range(1,10,0.5)
.
- Can anyone tell me a method range Float that solves the problem.