Concept
Parameters vs Arguments
Parameters are placeholders defined in the function signature `def greet(name):`. Arguments are actual values passed during the call `greet("Sam")`.
python
def greet(name): # name is the parameter
print(f"Hey, {name}!")
greet("Sam") # "Sam" is the argument
# 89. Parameters vs Arguments Parameters are placeholders defined in the function signature `def greet(name):`. Arguments are actual values passed during the call `greet("Sam")`: ```python def greet(name): # name is the parameter print(f"Hey, {name}!") greet("Sam") # "Sam" is the argument ``` Think of a parameter as an empty cup on a cafeteria tray. An argument is the soda you actually pour into it.
Checkpoint
In `def double(x):`, what is `x` called?
Practice
Define a function `shout(word)` that prints `word` with an exclamation mark (`print(word + "!")`). Call `shout("Python")`.
01
Tap code blocks below to assemble
Available Blocks