student = {
"name": "Alice",
"age": 20,
"grade": "A"
}
print("Student Details:", student)
#source code --> clcoding.com
Code Explanation:
Step 1: Creating a Dictionary
student = {
"name": "Alice",
"age": 20,
"grade": "A"
}
Here, we create a dictionary called student.
It contains three key-value pairs:
"name" → Stores "Alice" (a string).
"age" → Stores 20 (an integer).
"grade" → Stores "A" (a string).
Step 2: Printing the Dictionary
print("Student Details:", student)
The print() function is used to display the dictionary.
It prints the entire dictionary in key-value format.
Expected Output
Student Details: {'name': 'Alice', 'age': 20, 'grade': 'A'}
0 Comments:
Post a Comment