python / beginner
Snippet
Python Dictionaries
Dictionaries store data in key-value pairs, allowing you to look up information using a specific label instead of an index.
snippet.py
1
user_data = {"username": "dev_pro", "level": 10}
Breakdown
1
user_data = {
Starts the dictionary definition using curly braces.
2
"username": "dev_pro",
Defines a key 'username' with the string value 'dev_pro'.
3
"level": 10}
Defines a key 'level' with the integer value 10 and closes the dictionary.