Python for loop with small steps

for-loop, loops, python

Solution

[x * 0.01 for x in xrange(10)]

will produce

[0.0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09]

Problem

How can I make an for loop in python with steps of 0.01? I tried this but it doesn't work: ``` for X0 in range (-0.02, 0.02, 0.01): for Y0 in range (-0.06, 0.09, 0.01): ``` it says TypeError: range() integer end argument expected, got float.

Original source

Related problems