Print Numbers 1–100
Use a loop to print numbers from 1 to 100.
BeginnerTopic: Loop Programs
Python Print Numbers 1–100 Program
This program helps you to learn the fundamental structure and syntax of Python programming.
# Program to print numbers from 1 to 100
for i in range(1, 101):
print(i)Output
1 2 3 ... 100
Understanding Print Numbers 1–100
We use a simple for loop with range(1, 101) to generate integers 1 through 100 (upper bound is exclusive).
Note: To write and run Python programs, you need to set up the local environment on your computer. Refer to the complete article Setting up Python Development Environment. If you do not want to set up the local environment on your computer, you can also use online IDE to write and run your Python programs.