Questions
Write a python program to print all upper case and lower case alphabets.
Last Updated : 27 Jul 2026
Jan 23, Jul 24
Solution:
import string
# Approach 1: Using the built-in string module
print("Uppercase alphabets (A-Z):")
print(string.ascii_uppercase)
print("\nLowercase alphabets (a-z):")
print(string.ascii_lowercase)
# Approach 2: Using a loop with ASCII values (Alternative method)
print("\n--- Alternative Method using ASCII Values ---")
print("Uppercase:")
for i in range(65, 91):
print(chr(i), end=" ")
print("\n\nLowercase:")
for i in range(97, 123):
print(chr(i), end=" ")
print() # Print a new line at the end
Report an error