diff --git a/Chapter_06/6-12_extensions.py b/Chapter_06/6-12_extensions.py new file mode 100644 index 0000000..6dd4a49 --- /dev/null +++ b/Chapter_06/6-12_extensions.py @@ -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}") + +