How to check if an element that does not exist in a dictionary with Python

1 Answer

0 votes
dic = {"python": 1, "java": 2, "c": 3, "php": 4}

e = dic.get("c++")

if e is None:
    print("Not found")


'''
run:

Not found

'''

 



answered Oct 30, 2018 by avibootz
...