Computer Science, asked by vlsiddarth7, 5 months ago

Write a python program that takes a value and checks whether the given value is part of given dictionary or not. If it is, it should print the corresponding key otherwise print an error message.​

Answers

Answered by freedarajesh2003
2

Answer:

Explanation:

Here is source code of the Python Program to check if a given key exists in a dictionary or not. The program output is also shown below. d={'A':1,'B':2,'C':3} key=raw_input("Enter key to check:") if key in d. keys(): print("Key is present and value of the key is:") print(d[key]) else: print("Key isn't present!")

Answered by nandanipaul123
1

Explanation:

here is sources code of the python program to check if a given key exists in a dictionary or not.

Similar questions