What would you use instead of XXX if you want to check whether a certain ‘ key’ exists in a dictionary called diet? (Select two answers)

What would you use instead of XXX if you want to check whether a certain ‘ key’ exists in a dictionary called diet? (Select two answers)

II

if XXX:

print ("Key exists")
A . ‘key’ in diet
B . diet[‘key’] != None
C . diet.exists(‘key’)
D . ‘key’ in diet.keys()

Answer: B,D

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments