Hi All,
I'm just learning python.
I need user to enter Month and the print statement should print the complete Month
e.g.
Input = Jan
Output = January
#print(monthConversions[month]) works for me fine but I wanted to use a comparator to check if user has entered correctly and print Wrong Value if input is not appropriate.
Enter month in three digit Jan
Wrong Value
I'm just learning python.
I need user to enter Month and the print statement should print the complete Month
e.g.
Input = Jan
Output = January
#print(monthConversions[month]) works for me fine but I wanted to use a comparator to check if user has entered correctly and print Wrong Value if input is not appropriate.
monthConversions = { "Jan": "January", "Feb": "Februarzy", "Mar": "March", "April": "April", "May": "May", "June": "June", "July": "July", "Aug": "August", "Sep": "September", "Oct": "October", "Nov": "November", "Dec": "December", } month = input("Enter month in three digit ") if month == monthConversions: print(monthConversions[month]) else: print("Wrong Value ") # print("You entered " + str(month))After I run the code I get
Enter month in three digit Jan
Wrong Value