r/PythonLearning • u/Repulsive-Song-1594 • 3d ago
i am stuck with the range function
sorry but i am gonna crash out because of the range function i cant understand it well to use it this is driving me crazy any one could give me a video explaining everything i dont mind it being an hour long
8
Upvotes
View all comments
1
u/aiuniverse-3p3_here 3d ago
Bro, range is simple, don't crash out!
range(5) = 0,1,2,3,4 It starts from 0 and stops before 5.
range(1,6) = 1,2,3,4,5 First number is start, second is stop.
range(0,10,2) = 0,2,4,6,8 Third number is step, how much to jump.
Try this: for i in range(5): print(i)
You'll see 0 to 4. That's it!