Drop links or images here to add them to the editor.

Een dictionary slaat waarden op bij een sleutel. Je maakt er één aan met accolades {}:

gamescores = {"Tim": 500, "Janneke": 900, "Bob": 680}
print(gamescores)         # {'Tim': 500, 'Janneke': 900, 'Bob': 680}

# Waarde ophalen met sleutel
score_van_bob = gamescores["Bob"]
print(score_van_bob)      # 680

Kenmerken:

Lege dictionary aanmaken:

lege_dict = dict()
lege_dict2 = {}