Print Numbers 1–100 in Python
Use a loop to print numbers from 1 to 100.
BeginnerLoop ProgramsExample 1 of 25
print-numbers-1-100.py
1# Program to print numbers from 1 to 10023for i in range(1, 101):4 print(i)
Output
1 2 3 ... 100
What's going on
We use a simple for loop with range(1, 101) to generate integers 1 through 100 (upper bound is exclusive).
After this program
If the idea is still fuzzy, read Day 9: Loops and Iteration in the Python course. For a short check, try the Python quiz (300 questions). Stay with all 25 loop programs, or see every topic on Python exercises.