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