xFactorSchool.com
Python
JavaScript
How to Do Examples
C Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Compilers
C Compiler
C++ Compiler
C# Compiler
Java Compiler
Python Compiler
HTML Code Editor
CSS Code Editor
JavaScript Compiler
JavaScript Code Editor
Practice how to create a dictionary in Python
Python Online Editor
Execute Code
More Python Sample Codes
# Create a dictionary student = { "first_name": "John", # "first_name" is the key and "John" is the value "last_name": "Taylor", "age": 25, "grade": "A+" } print("This is an example of python dictionary") print(student) # Access values by key print("\nPrinting key value") print("First Name:", student['first_name'])# key must be inside a single ('') or double ("") quote print("Age:", student["age"]) # Modify a value student["age"] = 30 # Add a new key-value pair student["city"] = "Chicago" print("\nPrinting newly added key value") print("City:", student["city"])