๐Ÿ PyQuest๐Ÿญ Function Factory ยท ๐ŸŽ Functions With Ingredients
โญ 0 XP๐Ÿ Python is waking upโ€ฆ

Functions With Ingredients ๐ŸŽ

Your cheer() did the exact same thing every time. Kind of boring, right?

Put a name inside the parentheses when you define a function and it becomes a parameter โ€” a blank space you fill in when you call it:

def greet(name):
    print(f"Hey {name}! Welcome back ๐Ÿ‘‹")

greet("Zoe")      # โžœ Hey Zoe! Welcome back ๐Ÿ‘‹
greet("Milo")     # โžœ Hey Milo! Welcome back ๐Ÿ‘‹

One function, endless different greetings. Whatever you put inside the parentheses when you call it becomes name inside the function.

The parameter only exists inside the function โ€” it's the function's own private variable.

Your mission

  1. Build a function greet that takes one parameter: def greet(name):
  2. Inside, print a greeting that includes name (use an f-string)
  3. Call it with 3 different names so you get 3 different greetings

Your code

Press โ–ถ Run to see what your code does!