git_practice/homework06/DictionariesAndTry/dictionary3a.py
2025-12-14 18:34:36 -05:00

14 lines
472 B
Python

#!/usr/bin/python
# A directory example
dict = {'fName': 'Edward', 'lName': 'Bigos', 'Office': 617, 'Phone': '413-755-4544'}
try:
print("dict['fName'] dict['lName']: ", dict['fName']," ", dict['lName'])
print ("dict['Office']: ", dict['Office'])
print ("dict['Phone']: ", dict['Phone'])
# print ("dict['Mobile']: ", dict['Mobile'])
except KeyError:
print("Invalid key selected.")
print("Sorry, there is no key with that name in the directory.")
print("\n")