Python for Kids - Dictionary
- Dictionary is a collection for key-value pair.
A key should be unique. However a value does not have to be unique.
- Get a value of a dictionary
You can use get() to avoid errors when the key does not exist.
The get() will return None when the key does not exist.
The get() can return the default value when the key does not exist.
- Change a value of a dictionary
You can change the value by a key.
- Add an item into a dictionary
You can add an item using a new key/value pair.
- Remove a value from a dictionary
The pop() method removes the item with the key.
- Dictionary length
The len() function will return the length of the dictionary.
- Loop through a dictionary
You can loop through a dictionary by usng For.
Unlike a list, an order is not always the same.
More details can be found at:
https://pypykids.com/quiz/Access-a-value-of-a-dictionary/
⭐Python for Kids
https://pypykids.com
#Python #PythonForKids #PyPyKids #PythonForBeginner #PythonTutorial
Видео Python for Kids - Dictionary автора Питоновый анализ социальных сетей
Видео Python for Kids - Dictionary автора Питоновый анализ социальных сетей
Информация
2 декабря 2023 г. 14:49:04
00:05:10
Похожие видео