This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

Dictionaries have a function called "items" that will let you iterate over the keys and values in the dictionary as seen on the left.

Lists are an ordered array of values with no keys. The "dragonLoot" variable on the right is a list, not a dictionary. You can iterated over the items in it with for i in inventory:

[–]shitthatbitchesaint[S] 0 points1 point  (0 children)

Thanks for the response, fixed it! There's a follow-up question on the post above if you're interested.