1d = {"apples": 1, "banannas": 4}
2# Preferably use .keys() when searching for a key
3if "apples" in d.keys():
4 print(d["apples"])
5
1# How to find a key / check if a key is in a dict
2
3# Easiest way
4fruits = {'apple': 2, 'pear': 5, 'strawberry': 3}
5
6if 'apple' in fruits:
7 print("Key found!")
8else:
9 print("Key not found!")