Menu
Coddy logo textTech

Create Dictionary

Lesson 3 of 14 in Coddy's Dictionary in Python course.

To create a dictionary use the following syntax,

my_dict = {
	"name": "Alice",
	"age": 30, "city":
	"New York"
}

In this example, "name", "age", and "city<strong>"</strong> are keys, and "Alice", 30, and "New York" are their respective values.

challenge icon

Challenge

Easy

create a variable named person and assign to it a dictionary with following key values:

  • The value "John Doe" with the key "name"
  • The value 25 with the key "age"
  • The value "Los Angeles" with the key "city"
  • The value "johndoe@example.com" with the key "email"

Try it yourself

# Write code here

All lessons in Dictionary in Python