Ask coding questions

← Back to all posts
Saving a score to put in displayIntro in python?
erger561

How do you save something that is before displayIntro() and then put it in displayIntro() with the same value?

Voters
lolguineapig
Comments
hotnewtop
lolguineapig

@erger561 are you saying that you have a variable defined outside the function, and you want it to be defined in the function with the same value? If yes, you just have to use the keyword global.
Example:

That won't work ^
but this code will:

erger561

What I am saying is that I want the points to be in the displayIntro() with the same value as before the displayIntro()

erger561

Never mind, I think I know how to know.

erger561

If you do not understand what I am saying plat the code, so chose a game type what it says for you to type slots or spinandwin and then after you earn some points switch the game and it will say it does not know what points is.

erger561

In this case it is points that I need to save.