You can use a for loop with range() function to achieve a range from -0.1 to 0.1 at a path of 0.01. Here's the code:
main.py54 chars4 lines
In this code, we use the range() function with the start value of -10 and the end value of 11 (exclusive). The loop variable i
takes values from -10 to 10.
We then divide i
by 100.0 to get a float value between -0.1 and 0.1 in increments of 0.01. This float value is stored in the variable num
.
Finally, we print num
to display the value for each iteration of the loop.
gistlibby LogSnag