pairs to a dictionary without overriding the existing key?
I’m building a project requires users to give an answer that I will use as a key and value pair.
Everything is working well but if a user make a mistake and enter a key that already exists, it will override the existing one
You can add this condition if input in dict.keys(): pass
Check if a key exists, if it does don't add it
Обсуждают сегодня