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
Run in browser1# 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).