Completed 6-12 Extensions
This commit is contained in:
parent
fec94604d2
commit
9b1db511ac
21
Chapter_06/6-12_extensions.py
Normal file
21
Chapter_06/6-12_extensions.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Exercise 6-12 Extensions
|
||||||
|
# Learning Objective: Expand a previously written program.
|
||||||
|
|
||||||
|
'''
|
||||||
|
Code from 6-1:
|
||||||
|
person = {'first_name': 'fred', 'last_name': 'guy', 'age': '66', 'city': 'yonkers'}
|
||||||
|
|
||||||
|
print(person['first_name'])
|
||||||
|
print(person['last_name'])
|
||||||
|
print(person['age'])
|
||||||
|
print(person['city'])
|
||||||
|
'''
|
||||||
|
|
||||||
|
person = {'first_name': 'fred', 'last_name': 'guy', 'age': '66', 'city': 'yonkers'}
|
||||||
|
if 'occupation' not in person.items():
|
||||||
|
person['occupation'] = input(f"{person['first_name'].title()}'s occupation is missing, what is {person['first_name'].title()}'s occupation? \n")
|
||||||
|
|
||||||
|
for item in person.items():
|
||||||
|
print(f"{item}")
|
||||||
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user