Started Rectangle Project
This commit is contained in:
commit
26e1253c0d
39 changed files with 544 additions and 0 deletions
21
homework06/DictionariesAndTry/dictionary2.py
Normal file
21
homework06/DictionariesAndTry/dictionary2.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/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")
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue