Complete the code to call the function greet.
def greet(): print("Hello!") greet[1]
The function greet is called using parentheses () after its name.
Complete the code to return the sum of two numbers from the function.
def add(a, b): return a [1] b result = add(3, 4) print(result)
The add function returns the sum of a and b using the plus operator +.
Fix the error in the function call to print the message.
def say_message(msg): print(msg) say_message[1]
The function say_message needs a string argument inside parentheses and quotes, like "Hello!".
Fill both blanks to create a function that returns the square of a number and call it.
def square[1]: return x[2]2 result = square(5) print(result)
* instead of exponentiation **.The function square takes one parameter x (written as (x)) and returns x raised to the power of 2 using **.
Fill all three blanks to create a function that filters even numbers from a list and returns a new list.
def filter_even[1]: return [num for num in numbers if num [2] 2 == 0] nums = [1, 2, 3, 4, 5] even_nums = filter_even[3] print(even_nums)
== instead of modulo % in the condition.The function filter_even takes a list numbers as parameter. It returns a list of numbers where each number modulo 2 (% 2) equals zero. The function is called with the list nums.