python range step 0.1 code example
Example 1: python range for float
>>> import numpy as np
>>> np.arange(0.0, 1.0, 0.1)
array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
Example 2: range python 3
arr = [19,5,3,22,13]
for i in range(len(arr)):
print(arr[i])
for i in range(2, len(arr)):
print(arr[i])
for i in range(0, len(arr), 2):
print(arr[i])
for i in range(len(arr)-1, -1, -1):
print(arr[i])
Example 3: range python start at 1
>>> def range1(start, end):
... return range(start, end+1)
...
>>> range1(1, 10)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]