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

21 lines
687 B
Python

#!/usr/bin/python
# An office directory example
dict = {'fName': 'Robert', 'lName': 'Smith', 'Office': 620, 'Phone': '413-755-0000',"Email": "rsmith@example.com"}
print("dict['fName'] dict['lName']: ", dict['fName']," ", dict['lName'])
print ("dict['Office']: ", dict['Office'])
print ("dict['Phone']: ", dict['Phone'])
#Uncomment this next line and the program fails
#print ("dict['Mobile']: ", dict['Mobile'])
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:
print("We are in the except block")