You might find yourself in a situation where you have a bunch of data that all belongs together. For instance, your story might have a bunch of items, like a key, a water bottle, and a candle. Plus, you want to keep track of how many turns the player has played. You could put these all in global variables, like this
But then you need to include these global variables in any function where they might change. Instead, you can create one variable that can hold any amount of information you want, and just include that one variable in each of your functions. You can create that variable in the start function. It is called a dictionary, and it uses keys to refer to values.
In any function that needs to use or change player data, you just include the line “global player“, and you have access to all of it. You can add more dictionary entries any time you want.