4.2.3
range() and the end parameter (4.2.3) is a Class 10 Computer Science lesson for the Punjab boards. It walks through the idea in plain steps, then sets a short check, in English, Urdu or Roman Urdu.
Your guide: Miss HiraExplains computers with chai, cricket and your phone.
Chapter 1 of every subject is free. Unlock every chapter of this class with the full course.
Unlock full courseAlready paid? Sign in with the Google account you paid with.
range() generates a sequence of numbers for a for loop. range(stop) goes 0 to stop − 1; range(start, stop) goes start to stop − 1; range(start, stop, step) jumps by step.
for i in range(5) prints 0, 1, 2, 3, 4. range(2, 11, 2) gives 2, 4, 6, 8, 10. The stop value itself is never included.
print() normally ends with a new line. The end parameter changes this: print(i, end=" ") prints 1 2 3 4 5 on one line.
Step 1 / 1
range() generates a sequence of numbers for a for loop. range(stop) goes 0 to stop − 1; range(start, stop) goes start to stop − 1; range(start, stop, step) jumps by step.
for i in range(5) prints 0, 1, 2, 3, 4. range(2, 11, 2) gives 2, 4, 6, 8, 10. The stop value itself is never included.
print() normally ends with a new line. The end parameter changes this: print(i, end=" ") prints 1 2 3 4 5 on one line.
range(start, stop, step): start included, stop excluded.
Found a mistake? Tell us the lesson and the line at exciting@boringeducation.com.
No ads. Tell us what to fix.