Part of the series

Several example codes

~1 min read • Updated Oct 7, 2025

Program Overview

This Python program prints all the letters of the English alphabet from 'A' to 'Z'.
For each uppercase letter, its corresponding lowercase letter is printed on the same line.


Python Code:


for ch in range(ord('A'), ord('Z') + 1):
    uppercase = chr(ch)
    lowercase = chr(ch + 32)
    print(f"{uppercase} {lowercase}")

Sample Output:


A a  
B b  
C c  
...  
Y y  
Z z

Step-by-Step Explanation:

- The loop uses ord() to get the ASCII value of each uppercase letter
- chr() converts the numeric code back to a character
- The lowercase version is calculated by adding 32 to the uppercase ASCII code
- Each pair is printed together in order


Written & researched by Dr. Shahin Siami