Share
Check existence of an item
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Check if Apple exists in the dictionary below:
fruits={
“mango”:”yellow”,
“pear”:”green:,
“apple”:”red”,
}
Answer ( 1 )
# Assuming that code returns True if item exists in key and false if not
fruits={ “mango”:”yellow”, “pear”:”green” ,”apple”:”red”}
enterKey = input()
print(enterKey in fruits)