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

25 lines
721 B
Python

#!/usr/bin/python
# Create three dictionaries
dict1 = {'fName': 'Edward', 'lName': 'Bigos', 'Office': 617, 'Phone': '413-755-4544'}
dict2 = {'fName': 'Bill', 'lName': 'Gates', 'Office': 700, }
dict3 = {'fName': 'Harry', 'lName': 'Smith', 'Office': 677, 'Phone': '413-000-0000'}
# Put the three dictionaries in a list
staff = [dict1,dict2, dict3]
print(staff)
print("\n")
print("=============================\n\t\tDirectory\n=============================")
for person in staff:
# Person is a dictionary. Uncomment the next line to print the type.
#print(person, type(person))
try:
print(person['lName'], person['fName'], person['Phone'])
except:
print(person['lName'], person['fName'])