Mar-22-2018, 09:00 PM
(This post was last modified: Mar-22-2018, 09:00 PM by Gribouillis.)
I don't think there is an Idle issue here. You only need a global variable which value can be shared by the different functions. Don't use the same names for the functions and the variable. This can be done simply like this
karma = 0 def init_karma(): global karma # <- use this line if the function contains: karma = ... or karma += ... etc if italyStart() == True: karma = 10 init_karma() # <- don't forget to call the function that initializes the variable def theyShouldntBeHere(): while True: print("Wait, you're not supposed to be here! This is back-stage!") print("I guess you can [stay], but I'd rather you [leave].") print("") i = input(">") if i == "stay": print("Okay, I guess you can stay. Let's see what you did while you were here...") print("You had ", karma, " karma. Man, that's pretty ") if karma < 10: print("good.") elif karma > 10: print("screwed up.")This method works well as long as there are not too many global variables. In this case, you'll have to learn how classes work.