Complete the code to create a dictionary with keys as names and values as ages.
ages = {'Alice': 25, 'Bob': 30, 'Charlie': [1]The value for 'Charlie' should be an integer representing age, so 35 without quotes is correct.
Complete the code to access the value for key 'name' in the dictionary.
person = {'name': 'John', 'age': 22}
print(person[1])To get the value for the key 'name', use person['name'].
Fix the error in the code to add a new key-value pair to the dictionary.
data = {'x': 10, 'y': 20}
data[1] = 30To add a new key 'z' with value 30, use data['z'] = 30.
Fill both blanks to create a dictionary comprehension that maps numbers to their squares for numbers greater than 2.
squares = {x: x[1]2 for x in range(1, 6) if x [2] 2 }The operator for power is '**' and the condition to filter numbers greater than 2 is '>'.
Fill all three blanks to create a dictionary comprehension that maps uppercase keys to values only if the value is positive.
result = [1]: [2] for k, v in data.items() if v [3] 0 }
Use k.upper() for uppercase keys, v for values, and '>' to filter positive values.