Q. Write python code to add to a existing dictionary ?
Q. Write python code to check existance of a key in a dictionary ?
Q. Write python code to create a dictionary that will contain number from one to n and square of given range ?
Answers
Answered by
1
Here is ur answer mate
⏬⏬⏬⏬⏬⏬⏬⏬⏬
⏭️⏭️Python add to Dictionary. There is no explicitly defined method to add a new key to the dictionary. If you want to add a new key to the dictionary, then you can use assignment operator with dictionary key. Note that if the key already exists, then the value will be overwritten.⏮️⏮️
⏭️⏭️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!")⏮️⏮️
✔️✔️✔️✔️✔️✔️✔️✔️✔️
↫↫↫↫↫ Hope it helps you
Plz mark me brainlist ↬↬↬↬↬
Similar questions