Complete the code to define a function named greet that takes one parameter called name.
def greet([1]): print(f"Hello, {name}!")
The function parameter should be named name to match the usage inside the function.
Complete the code to call the function greet with the argument 'Alice'.
greet([1])When calling a function with a string argument, the string must be in quotes. Here, "Alice" is correct.
Fix the error in the function definition by completing the parameter list correctly.
def add_numbers([1]): return a + b
Function parameters must be separated by commas. So a, b is correct.
Fill both blanks to create a function that returns the product of two numbers x and y.
def multiply([1], [2]): return x * y
The function parameters should be x and y to match the return statement.
Complete the code to create a function that returns a dictionary with keys as uppercase names and values as ages greater than 18.
def filter_adults(data): return {name.upper(): age for name, age in data.items() if age [1] 18}
The function returns a dictionary comprehension, so it starts with {. The condition checks if age is greater than 18, so > is correct.