Page 1 of 1

Python: Making a Dictionary

Posted: Tue Apr 07, 2026 5:22 pm
by Jason
Dictionaries are the same thing as associative arrays in other languages. They consist of key and value pairs and there can't be duplicate keys.

Code: Select all

dictionary_of_car_owners = {"Amber" : "Ford", "Joey" : "Chevy", "Jerry" : "Toyota", "Jane" : "Hyundai"}

print(dictionary_of_car_owners)

# Below is another way to make one.

dictionary_of_basketball_players = dict(Amber = "Tigers", Joey = "Bears", Jane = "Lions")

print(dictionary_of_basketball_players)