Mar-22-2018, 06:50 PM
I'm in a fundamentals of computer science class at my school, and encountered an issue my teacher can't answer. I'm coding a method-based text adventure game with a "karma" system designed to give the user an ending. It looks something like this:
I defined this method at the start of the code, and as the code proceeds I either add or remove one point from the integer. By the end, I have this display:
However, I get a consistent issue of karma not being recognized, and it instead returning the first line under "stay", but then looping back to the beginning of the program. If you notice any other issues, please note them as well!
PS: this is my first post to this forum. If I accidentally broke any rules, please tell me and I'll revise the post! Thanks for the help.
1 2 3 |
def karma(): if italyStart() = = True : karma = int ( 10 ) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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." ) |
PS: this is my first post to this forum. If I accidentally broke any rules, please tell me and I'll revise the post! Thanks for the help.