Recap - Recipe Manager
Part of the Logic & Flow section of Coddy's Python journey — lesson 11 of 78.
Challenge
EasyYou are managing a digital recipe book where each recipe is stored as a dictionary. Each dictionary contains the name of the recipe as the key and a list of ingredients as the value. Your task is to perform several operations to update and manage the recipe book.
- Create the Recipe Book:
Create a dictionary namedrecipe_bookwith the following recipes:"Pancakes":["flour", "milk", "eggs", "sugar"]"Salad":["lettuce", "tomato", "cucumber", "olive oil"]
- Access Ingredients:
Print the list of ingredients for"Pancakes". - Add a New Recipe:
Add a new recipe"Smoothie"with the ingredients["banana", "milk", "honey"]to the dictionary. - Modify a Recipe:
Add"blueberries"to the"Smoothie"recipe. - Print All Recipes:
Print the entirerecipe_bookdictionary to verify the updates.
Try it yourself
# Write code hereAll lessons in Logic & Flow
1Variables Exploration
ConstantsMultiple Variable AssignmentsSwapping VariablesPlaceholder VariablesRound NumbersList Casting4Contact Book Application
Display MenuAdd Contact7Sets Part 2
Mathematical Operations Part 1Mathematical Operations Part 2Recap - Treasure HuntSubsets and SupersetsIterating Over SetsRecap - Tournament Tracker2Dictionaries Part 1
What is a Dictionary?Creating a DictionaryAccessing ValuesModifying DictionariesRecap - Recipe Manager5Advanced Decision Making
Ternary OperatorMembership ChecksIdentity ChecksIndentation ErrorsRecap - Vacation Filter8Student Records Manager
Project OverviewAdd Student11Advanced Functions
Returning Multiple ValuesLambda Functions Part 1Lambda Functions Part 2Recap Challenge - Lambda SortRecursive Functions Part 1Recursive Functions Part 2Recap - Sum Nested List14Higher-Order Functions
The Map FunctionThe Filter FunctionRecap - Email ValidatorRecap - Number Processor3Dictionaries Part 2
Dictionary MethodsNested DictionariesChecking for KeysLooping Through DictionariesRecap - Frequency Counter9Advanced Data Aggregation
Using SumFinding Minimum and MaximumSorting Data EfficientlyRecap - Dictionary Sorter