Modifying a Dictionary

spread[“past”] = tarot.pop(13) IN this code, does the computer first execute the left side or the right? I was confused cuz I thought tarot.pop(13) was only gonna remove the value corresponding to 13 but then we r assigning that value to spread[“past”]? can we do that at the same time?

Not sure which language is this but method pop is a rather standard one and I can assure you that you will find something along these lines in the documentation:

pop(i): remove the item at the position i in the list, and return it.

Let’s assume that value of tarot at index 13 is a string "Lorem ipsum". This is how the execution would go:

  1. spread[“past”] = tarot.pop(13)
  2. retrieve value of node at index 13
  3. remove node at index 13
  4. spread[“past”] = "Lorem ipsum"
1 Like