dimanche 28 août 2016

can not break the statement twice

i have a problem with my code,as you can see there's a break statement and a function that can re-loop(i guess)the code,my problem is,if i try to break the statement using the "e" button for the second time it's still looping,help pls?!

class forwarding(): def forward(self): print("you've moved forward!")

class jumping(): def jump(self): print("you've jump!")

class moving(forwarding, jumping): pass

moves = moving()

def Game_on(): while True: move = input("Press 'D' to move forward or 'W' to jump\n") if move is "d": moves.forward() print("You fell and DIE!!!") retry = input("Press 'R' to retry or 'E' to exit the game\n") if retry is "r": Game_on() elif retry is "e": print("You've exit the game") break elif move is "w": moves.jump() print("You just got hit by a plane and DIE!!!") retry = input("Press 'R' to retry or 'E' to exit the game\n") if retry is "r": Game_on() elif retry is "e": print("You've exit the game") break else: print("Make sure to type the moves that are available")

Game_on()

Aucun commentaire:

Enregistrer un commentaire