Apr-03-2020, 07:12 PM
(Mar-28-2020, 10:07 AM)buran Wrote: You want to do
if month in monthConversions: print(monthConversions[month]) else: print("Wrong Value ")however,there is more pythonic ways to do it
one would be
try: print(monthConversions[month]) except KeyError: print("Wrong Value")the best would be
print(monthConversions.get(month, "Wrong Value"))
Thanks alot the if month in month.conversations worked for me. This Is what I was exactly looking for.