How to check if key exist in key-value dictionary in Python

1 Answer

0 votes
language = {'python': 3, 'php': 5, 'java': 6}
 
if "php" in language:
    print("php exist")
else:
    print("php not exist")
 
 
'''
run:
 
php exist
 
'''

 



answered Aug 27, 2018 by avibootz

Related questions

1 answer 126 views
1 answer 145 views
1 answer 204 views
1 answer 193 views
...