~2 min read • Updated Oct 3, 2025
Program Overview
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.
Title 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 |
Python Code:
# 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")
Sample Output:
Enter a character to identify the title: P
Title: پروفسور (Professor)
Enter a character: j
Title: عالیجناب (Excellency)
Step-by-Step Explanation:
- 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
Written & researched by Dr. Shahin Siami