details = {"name": "Alice", "age": 25, "grade": "A"}
print("Dictionary Example:", details)
#source code --> clcoding.com
Code Explanation:
Creating a Dictionary:
details = {"name": "Alice", "age": 25, "grade": "A"}
A dictionary named details is created using {} (curly braces).
It consists of key-value pairs:
"name" → "Alice"
"age" → 25
"grade" → "A"
Printing the Dictionary:
print("Dictionary Example:", details)
The print() function is used to display the dictionary.
It outputs:
Dictionary Example: {'name': 'Alice', 'age': 25, 'grade': 'A'}
0 Comments:
Post a Comment