The following dictionary is given: companies = {'TSLA': 800.0, 'NVDA': 145.6} What value will be returned when trying to read 'AMZN' key?

Questions & AnswersCategory: PythonThe following dictionary is given: companies = {'TSLA': 800.0, 'NVDA': 145.6} What value will be returned when trying to read 'AMZN' key?
Lokesh Kumar Staff asked 2 years ago

The following dictionary is given:

companies = {'TSLA': 800.0, 'NVDA': 145.6}

What value will be returned when trying to read 'AMZN' key?
a. The NameError will be raised.
b. The KeyError will be raised.
c. False
d. 800.0
e. The IndexError will be raised.
f. None

1 Answers
Lokesh Kumar Staff answered 2 years ago