FREE INTERACTIVE ONLINE COURSE

Python 3

FOR BEGINNERS


"The first Python course that simply amazed me. Very well explained and easy to understand." (Alexandru Cosmin)

"The best Python course in Romania." (Iulian Geană)


ALL REVIEWS
LESSON 16
PAGE 4 / 5
Dictionaries in Python
Home >>> Free Online Lessons, Python 3

Modifying and Adding Key-Value Pairs

To modify or add a key-value pair in the dictionary, we use direct assignment – the structure is mutable:
Editor - lesson_16.py
       
Console/Output done
DETAILS

We created a dictionary that contains two key-value pairs. Then, we added a new one consisting of the key "big" and the associated value, "small". Finally, we modified the value of that key with a new one, like an update, for the sake of example - "tiny".
Proceed to the next page.
 home   list  CONTENTS   perm_identity   arrow_upward