14
Question Question 14
What would the following code print ?
d = {'spring':'autumn','autumn':'fall','fall':'spring'}
print(d['autumn'])- autumn
- fall
- spring
- Error
fall
Reason — The values of dictionaries can be accessed by giving the key inside the square brackets of dictionary. The expression d['autumn'] will return "fall" as autumn is the key of dictionary d so d['autumn'] will return its value i.e., "fall".