Game: restart feature | Sololearn: Learn to code for FREE!

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

3/29/2020 4:26:43 AM

sudo-asap

1 Answer

New Answer

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.