Why do I get a KeyError when creating my spread?

for key , values in spread.items():
  spread += tarot.pop(13)

I don’t know why I get KeyError even when the key is present. Can someone explain where I am going wrong?

Iterate through the items in the spread dictionary and for each key: value pair …
I guess the word “pair” is confusing.

First you add the tarot.pop(KEY) command to the spread list:

spread[“past”] = tarot.pop(13)

if you think about it: tarot.pop(13) gets only triggered, by calling the value of its key = [“past”] .
spread = {key: value} or spread = {“past”: tarot.pop(13)}
(key) = “past”
(spread[key]) = Value = tarot.pop(13) = remove & returns Key + Value (13: “Death”) from tarot dictionary

in your case:

for key in spread:
      print(" Your " + (key) + " is the " + (spread[key]) + " card." )



hope that helps