From 9b1db511acba9972e9a437e50b3b47d352d6903e Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Sat, 1 Feb 2025 09:36:54 -0500 Subject: [PATCH] Completed 6-12 Extensions --- Chapter_06/6-12_extensions.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Chapter_06/6-12_extensions.py 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}") + +