Module 6

Parameters

Passing values into a function.

Making functions flexible

A parameter is a variable that receives a value when the function is called. It makes the function flexible.

Python
def greet(name):
    print(f"Hello, {name}!")

greet("Alice")
greet("Bob")
Hello, Alice! Hello, Bob!
Your task

Add a parameter

  • Define greet(name) that prints Hello, {name}!. Call it with Alice.