This Python program reads a character from the user and converts it to lowercase if it's an uppercase English letter.
The conversion uses a lookup dictionary and avoids using the + operator entirely.
# Mapping table from uppercase to lowercase
uppercase_to_lowercase = {
'A': 'a', 'B': 'b', 'C': 'c', 'D': 'd', 'E': 'e',
'F': 'f', 'G': 'g', 'H': 'h', 'I': 'i', 'J': 'j',
'K': 'k', 'L': 'l', 'M': 'm', 'N': 'n', 'O': 'o',
'P': 'p', 'Q': 'q', 'R': 'r', 'S': 's', 'T': 't',
'U': 'u', 'V': 'v', 'W': 'w', 'X': 'x', 'Y': 'y', 'Z': 'z'
}
# Read character from user
char = input("Enter a character: ")
# Convert and display
if char in uppercase_to_lowercase:
print(f"Lowercase version: {uppercase_to_lowercase[char]}")
else:
print(f"Unchanged output: {char}")
Input: A
Output: a
Input: g
Output: g