Q. Write a Python script to check if a given key already exists in a dictionary.


Answer =

Dictionary have unique key only. So this program is not possible.

1 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. d={1:10,2:20,3:30} a=int(input("Enter key you want to search for-")) if a in d: print(a,"key is present in dictionary") else: print(a,"key is not present in dictionary")

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post