Complete the code to unpack the tuple into variables a and b.
t = (5, 10) a, [1] = t print(a, b)
The tuple t has two values. We unpack them into variables a and b. So b is the correct variable name to match the second value.
Complete the code to unpack the tuple and print the second value.
coordinates = (3, 7) x, [1] = coordinates print(y)
The tuple coordinates has two values. We unpack into x and y. To print the second value, the variable must be y.
Complete the code to unpack the tuple into variables a, b, and c.
values = (1, 2, 3) a, b, [1] = values print(a, b, c)
The tuple values has three elements. Unpack them into variables a, b, and c so the print statement works correctly.
Fill both blanks to create a dictionary with keys as names in uppercase and values as ages over 20.
people = {name[1]: age for name, age in data if age [2] 20}< instead of > for filtering..lower() instead of .upper() for keys.The dictionary comprehension uses name.upper() to make keys uppercase and filters ages greater than 20 using age > 20.
Fill all three blanks to create a dictionary with keys as uppercase names, values as ages, filtered by age greater than 25.
result = [1]: [2] for name, age in people if age [3] 25}
name.lower() instead of name.upper().< instead of > for filtering.The dictionary comprehension uses name.upper() as keys, age as values, and filters ages greater than 25 with age > 25.