This Python program reads a single character from the user that represents a personal title.
Based on the input, it prints both the Persian and Latin version of the title using a predefined lookup table.
| Input Symbol | Persian Title | Latin Title |
|---|---|---|
| b, B | بانو | Lady |
| d, D | دوشیزه | Miss |
| p, P | پروفسور | Professor |
| m, M | آقا | Mr |
| j, J | عالیجناب | Excellency |
| a, A | خانم | Wife |
# Read input from user
ch = input("Enter a character to identify the title: ").strip().lower()
# Match against lookup table
if ch == 'b':
print("Title: بانو (Lady)")
elif ch == 'd':
print("Title: دوشیزه (Miss)")
elif ch == 'p':
print("Title: پروفسور (Professor)")
elif ch == 'm':
print("Title: آقا (Mr)")
elif ch == 'j':
print("Title: عالیجناب (Excellency)")
elif ch == 'a':
print("Title: خانم (Wife)")
else:
print("Invalid input. Please enter one of the following: b/d/p/m/j/a")
Enter a character to identify the title: P
Title: پروفسور (Professor)
Enter a character: j
Title: عالیجناب (Excellency)
- The input is normalized using .strip().lower() for consistency
- The program uses if/elif conditions to match the input with the correct title
- If the input is not in the table, an error message is displayed