#PythonDictionaries
#ProgramtoCheckifaGivenKeyisAlreadyExistsinaDictionaryrNot
#PythonPrograms
Write a program to check if a given key is already exists in a dictionary or not?
d={101:'python',102:'c',103:'cpp',104:'java'}
n=int(input('enter key to be search'))
if n in d.keys():
print('The given key is present and the value of the key is')
print(d.get(n))
else:
print('given key is not present in a dictionary')
11
Watch video Program to Check if a Given Key is Already Exists in a Dictionary or Not? online without registration, duration hours minute second in high quality. This video was added by user ViaDigitally 23 April 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 186 once and liked it 4 people.