0

Game: restart feature

Why doesn't this code work? I get an 'expected indented block' error. print("Player died") restart = input('Restart? y/n') if restart in ['y', 'n']: if restart == 'y': # code for y if restart == 'n': # code for n) else: print('typed something else other than y/n') restart

29th Mar 2020, 4:26 AM
sudo-asap
sudo-asap - avatar
1 Antwort
0
Is this your exact code? If yes, then you cannot have an if statement without any other statements inside. For example: if restart == "y": #code for y if restart == "n": In here, you have no other statement after if statement. Just add a line after if restart == "y": And it will work fine.
29th Mar 2020, 4:49 AM
XXX
XXX - avatar