← All lessons

Parameters

Sign in · Sign up

Lesson 6.1

Parameters are the input data of a function, one value for each:

def greet(name, age):
    print(f"Hello, {name}! You are {age}.")

greet("Mia", 14)

Parameter names live only inside def. When you call the function, values take their place — those are called arguments. As many parameters as there are in the brackets, that many arguments go in the call.

The name person and the age years are set by the check. Write greet(name, age) that prints Hello, <name>! You are <age>., and call it with these values.

Hint

Parameters are the names in the brackets of def, arguments are the values in the call.

Inside the function build the phrase with an f-string and print it. Then call the function with the variables from the task — two lines in order: def, then the call.