Part of the series

Several example codes

~1 min read • Updated Sep 29, 2025

Program Overview

In this chapter, we introduce a Python program that performs repetitive operations from 10 to 100 and displays the output in a structured table.
Initially, this task may be written with many lines of code, but in the next chapter, we’ll use loops to simplify and reduce the number of instructions.
This approach improves maintainability and readability.


Python Code Using a Loop:


# Generate repetition table from 10 to 100
print("--- Repetition Table from 10 to 100 ---")
for i in range(10, 101, 10):
    print(f"Number: {i} | Square: {i**2} | Root: {i**0.5:.2f}")

Sample Output:


--- Repetition Table from 10 to 100 ---  
Number: 10 | Square: 100 | Root: 3.16  
Number: 20 | Square: 400 | Root: 4.47  
...  
Number: 100 | Square: 10000 | Root: 10.00

Explanation:

- A for loop iterates from 10 to 100 in steps of 10
- For each number, the program prints its value, square, and approximate square root
- This method significantly reduces the number of lines compared to manual repetition


Written & researched by Dr. Shahin Siami