- What is Dict in Python? Dict (short for Dictionary) in Python is a storage data type like List and Tuple, Dict has the function to store values containing key and value, and these data are not sorted in a certain way. any order.
The Dict in python is determined by the following factors:
- Confined to curly braces { }, everything inside the braces is interpreted as an element of the Dict.
- Dict elements are separated by commas ","
- Dict's elements must be a key-value pair
- The key-value pair of the element in the Dict is separated by a colon ":"
- Keys must be a hash object
- How to initialize a Dict's element in Python 2.1 Use curly braces {} and put the value inside curly braces To add 1 or n elements to the Dict data type in Python, you do the following syntax:
Syntax: {, , .., }
==> Click to learn more: https://mcivietnam.com/kieu-du-lieu-dict-trong-python/
Top comments (1)
Relevant link to lern more abot dictionaries