From 799ec174a1b8c0bcdf5919d12520cedf800e6260 Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Sun, 26 Jan 2025 20:35:06 -0500 Subject: [PATCH] Completed 6-4 Glossary 2 --- Chapter_06/6-04_glossary2.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Chapter_06/6-04_glossary2.py diff --git a/Chapter_06/6-04_glossary2.py b/Chapter_06/6-04_glossary2.py new file mode 100644 index 0000000..7349eb9 --- /dev/null +++ b/Chapter_06/6-04_glossary2.py @@ -0,0 +1,33 @@ +# Exercise 6-4 Glossary 2 +# Learning Objective: Loop through dictionary. + +words = { +'loop': 'A repetetive process of actions.', +'operator': 'A symbol of an action to take place.', +'if statement': 'A conditional process.', +'variable': 'An object that can change its value.', +'constant': 'An object whose value does not change.', +#added 5 more definitions: +'dictionary': 'An container of key-value pairs.', +'set': 'A list of keys or value that are unique and contain no duplicates.', +'output': 'The result of a command or action.', +'keys': 'An element of a dictionary with an associated value.', +'value': 'An element of a dictionart linked to its key.', +} +for word, definition in words.items(): + print(f"\n{word.title()} is defined as:\n{definition}") + + +# old code from 6-03_glossary.py +''' +print(f"Loop:\n{words['loop']}\n--------------------------------------------") + +print(f"\nOperator:\n{words['operator']}\n--------------------------------------------") + +print(f"\nif Statement:\n{words['if statement']}\n--------------------------------------------") + +print(f"\nVariable:\n{words['variable']}\n--------------------------------------------") + +print(f"\nConstant:\n{words['constant']}\n--------------------------------------------") +''' +