Let’s learn how to add an element to a dictionary in Python.
We have a dictionary.
languages_I_know = {1:"Javascript", 2:'Kotlin'}
Extending the dictionary
To add another element just call your dictionary with next element as index and value as parameter.
languages_I_know = {1: 'Javascript', 2: 'Kotlin'} print(languages_I_know) languages_I_know[3] = 'Python' print(languages_I_know)
That’s how, thanks to Pythoneo.com, Python has been added to languages you know đ