Check the Existence of Keys (Exercise)
00:00
Now the Captain’s Dictionary contains some key-value pairs, and now you need to check the existence of two keys. Write two if
statements that check if the string Enterprise
and the string Discovery
, both with an uppercase first letter, exist as keys in the dictionary.
00:19
If the key doesn’t exist, set their value to the string unknown
.
Become a Member to join the conversation.