for loop

in python is there a for loop with a step tht we can add

like for i = 1 to 10 step 2 …

any example of this available or any othere way to do this ?


 for i in range(1,10, 2):
    print i


seems that this loop always start with 0 not the minimum value in the range ?

is there one that start with the minimum value ?

or if i have to do it manually ?

The Tutorial is a good place to start, or the language reference Manual.

Actually range(.,.,.) returns a list that starts with the minimal value you specify up to the maximumvalue-1, just as teeth posted. Only if you don’t pass a first argument, then the DEFAULT minimum value is 0. If you use range(x,y), it will use x as minimal value, just as in
for(i = x; i < y; i++)
or something similar.

seems that it need integer in the range values

and i have a real number

so i’ll have to do it by hand with and if function