Print Numbers from 1 to 10 in Python

Printing numbers from 1 to 10 is one of the most basic tasks in Python programming.

It helps beginners understand loops and the range function.

Concept Overview

Python provides the range() function to generate sequences of numbers.

We can use loops to iterate through these numbers and print them.

Method 1: Using for Loop

Python
for i in range(1, 11):
    print(i, end=", ")

Method 2: Using join()

Python
print(", ".join(str(i) for i in range(1, 11)))

Method 3: Each Number on New Line

Python
for i in range(1, 11):
    print(i)

Output

TEXT
1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Detailed Explanation

range(1, 11) generates numbers starting from 1 up to 10.

The end value is exclusive, so 11 is not included.

The end parameter in print() controls how output is formatted.

Applications

Used in loops, counting operations, and basic program logic.

Advantages

Simple and easy to understand.

Useful for beginners learning loops.

Limitations

Not suitable for very large ranges without optimization.

Improvements You Can Make

Print numbers in reverse order.

Print only even or odd numbers.

Format output in different styles.

Mastering simple loops is the foundation for advanced Python programming.