Ex35 Study drill

https://drive.google.com/file/d/1sgOHwPnXo245ixdASnTqJhSZFq3n08MV/view?usp=sharing

Hello fellow mates,
Above is a link of a simple game that as a part of study drill ex35 I have been writing.
(if possible please someone paste the script in comments)
First it is still incomplete, but still could be run in the cmd prompt, and i have added comments for my (and your) convenience.
Secondly, i have corrected typing mistakes, so you can run it freely in your pc.
Third, I am stuck at rightPath – [any ideas are appreciated :slight_smile: ]
Fourth, syntax is not up to the mark but hey its just for practice i will learn PEP8.
Fifth, i want to run def mainQuesK if the player has already taken the leftPath, help me in this, please. I get an error that a k is not defined, (probably because it is defined in the other function, but trying to define it right there as k = False proves to be wrong because then the value of k remains False and does not change from function kraken()

Thank you

what i mean is that a player has two ways to choose from right and left. He went to left path once. Next if again he chose to go to left path then I want to run a different function. How do i write ‘if’ condition regarding that?

I think you need the global keyword to make mainQuesK work. It works like this:

WENT_LEFT = False


def leftPath():
    global WENT_LEFT
    WENT_LEFT = True

def main():
    global WENT_LEFT
    if WENT_LEFT: dostuff

Try that out.

1 Like

yes it works, thank you.