Complete the code to add a docstring that describes the function.
def greet(name): [1] return f"Hello, {name}!"
The correct docstring uses triple double quotes and describes what the function does.
Complete the code to add a docstring that explains the parameters.
def add(a, b): [1] return a + b
The correct docstring explains the function, its parameters, and the return value clearly.
Fix the error in the docstring format.
def multiply(x, y): [1] return x * y
The correct docstring uses triple double quotes to properly format the docstring.
Fill both blanks to create a dictionary comprehension that documents word lengths for words longer than 3 characters.
words = ['apple', 'bat', 'carrot', 'dog'] lengths = {word: [1] for word in words if len(word) [2] 3}
The dictionary comprehension uses len(word) to get length and filters words with length greater than 3.
Fill all three blanks to create a dictionary comprehension that maps uppercase words to their lengths if length is greater than 4.
words = ['tree', 'house', 'car', 'elephant'] result = [1]: [2] for word in words if len(word) [3] 4
The comprehension maps uppercase words to their lengths, filtering words longer than 4 characters.