how to use range function in python code example
Example 1: range in python
#range(start,stop,step)
for x in range(0,20,2):
print(x)
Example 2: range py
range(start, stop, step)
x = range(0,6)
for n in x:
print(n)
>0
>1
>2
>3
>4
>5
Example 3: range in python
for i in range (start, step, stop):
dosomething()
Example 4: range() python
#can be used a sequence of numbers
x = range(6)
print(x)
#Outputs 0 1 2 3 4 5
for i in range(start,finish ,step)
#gives range of numbers
#start is optional default is 0
#finish needed specifying when to stop
#step is incremetntaition of jump also optional
Example 5: python in range
for value in range (start, step, stop):
pass
# note that the stop will not include