

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 7
click for more info
Not enough gems
Cost: 6 gems
1: Lists
incomplete
2: Lists Continued
incomplete
3: Counting in Programming
incomplete
4: Indexing Into Lists
incomplete
5: List Length
incomplete
6: List Updates
incomplete
7: Appending in Python
incomplete
8: Pop Values
incomplete
9: Counting the Items in a List
incomplete
10: No-Index Syntax
incomplete
11: Find an Item in a List
incomplete
12: Find the Increase
incomplete
13: Find Max
incomplete
14: Modulo Operator in Python
incomplete
15: Slicing Lists
incomplete
16: List Operations – Concatenate
incomplete
17: List Operations – Contains
incomplete
18: List Deletion
incomplete
19: Tuples
incomplete
20: First Element
incomplete
21: Reverse List
incomplete
22: Filter Messages
incomplete
23: Even Teams
incomplete
24: Alchemy Ingredients
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Fantasy Quest added a new Alchemy skill.
Complete the check_ingredient_match function. It accepts two lists of strings:
recipe: The list of ingredients needed.inventory: The list of ingredients the character has.It should return two values:
Assume that the recipe list won't contain any duplicates (recipes require only one ingredient of each kind).
For example, if these were the lists:
recipe = ["Dragon Scale", "Unicorn Hair", "Phoenix Feather", "Troll Tusk"]
inventory = ["Dragon Scale", "Phoenix Feather", "Troll Tusk"]
percentage, missing_ingredients = check_ingredient_match(recipe, inventory)
print(percentage, missing_ingredients)
# Prints: 75.00 ["Unicorn Hair"]
Your spellbook entry about the "in" keyword may be helpful here! Just search for "List Operations – Contains."