Please help about a project

Hi, and thanks in advance
I’m trying to make a game with choices and if you make the wrong choice you should be sent back to try again, the text is all ok but function is not repeatable or i cant make it so you can choose again
This is how it looks
def start():
print(‘There are 4 possible ways out\n You can walk through the front door wich is in front of you “w”\n jump out the left window “a”\n jump out the right window “d”\n lay “back” on the bed “s”’)
i=input(‘You should move or choose with “w,a,s,d” type here–>’)
if " " in i:
print(‘no spacebar is required’)
elif “right” in i:
print(‘typing is not necesary’)
elif “left” in i:
print(‘typing is not necesary’)
elif “forward” in i:
print(‘typing is not necesary’)
elif “back” in i:
print(‘typing is not necesary’)
elif “w” in i:
print(‘You open the door just to be hit by an illusion of a dark dungeon, there is no sunshine anymore only torches…\n you should make haste and find out what is happening’)
elif “s” in i:
print(‘You take a good nap, you are well rested now…’)
repeat_function=start()
elif “a” in i:
print(‘you try to jump out the window, but somehow it doesn’t work, it’s like hitting a wall’)
returned_fuction = start()
elif “d” in i:
print(‘you try to jump out the window, but somehow it doesn’t work, it’s like hitting a wall’)
returned_fuction = start()
else:
print(‘Please move your character only using the “w”, “a”, “s”, “d”’)
returned_function = start()

Thanks a lot!

Hi @Blackc. Welcome to the users forum. I’m not myself much of a Discourse user, but I think you will need to reformat your code. For example, paste your code into the editor:

def myfunc(a):
    return a + 2

highlight it with your mouse, then select the </> button at the top of the page. Note that in my simple function above my indentation is preserved and the code has been highlighted.

You mentioned

Can you be more explicit? If you execute start() a second time does it not work? Or do you mean for it to repeat the question the call to input() and following tests with a single call to start()?

Hello and thanks for your help, I want the code to repeat the first question, basically to return back to start() and still allow me to make a new decision if i didn’t meet the correct requirment which is “w”. Thanks again!

Then I think you want a loop within start(). Maybe while True: with a special response from the user to break out of the loop.

Thank you sir!