Complete the code to define a function that takes two parameters and returns their sum.
def add_numbers(a, [1]): return a + b
The function needs two parameters named a and b to add them correctly.
Complete the code to call the function with two arguments 5 and 7.
result = add_numbers([1], 7) print(result)
The function add_numbers expects two numbers. We pass 5 as the first argument and 7 as the second.
Fix the error in the function definition to accept three parameters.
def multiply_three(a, b, [1]): return a * b * c
The third parameter must be c to match the variable used in the return statement.
Fill both blanks to create a function that returns the average of two numbers.
def average([1], [2]): return (x + y) / 2
The parameters must be x and y to match the variables used in the return statement.
Fill all three blanks to create a function that returns a dictionary with keys as parameter names and values as their squares, only if the value is greater than 0.
def squares_dict([1], [2], [3]): return {k: v**2 for k, v in zip(['a', 'b', 'c'], [[1], [2], [3]]) if v > 0}
The function parameters must be a, b, and c to match the keys and values zipped in the dictionary comprehension.