More Than One Ingredient ๐งช
Functions can take as many parameters as you want โ just separate them with commas:
def order(drink, size):
print(f"One {size} {drink}, coming right up!")
order("hot chocolate", "large") # โ One large hot chocolate, coming right up!
Order matters! The first thing you pass lands in the first parameter, the second in the second. Swap them and you get:
order("large", "hot chocolate") # โ One hot chocolate large, coming right up! ๐คจ
Same function, silly result. Python does exactly what you say, not what you meant. ๐
Your mission
Open a potion shop!
- Build a function
make_potionwith two parameters:def make_potion(color, power): - Inside, print one sentence that uses both of them (f-string!)
- Call it 3 times with 3 different color-and-power combos
Your code
Press โถ Run to see what your code does!