I've been learning Python for a few days, made my first program. It's simple and stupid but It's a step. Can anyone scrutinize this and give me some noob tips?
<code>print('Welcome to Hell!')
def gamename():
print("You are standing In a hallway thinking.... You want to move \n but where to? Left, right, up or down?")
answer = input()
if answer == 'left' or 'Left':
print('You move to your left and see a knife, you trip \n being the dumb weeaboo you are, puncturing your torse enjoy death.')
gamename()
elif answer == 'right' or "Right":
print('You turn to your right with movement, triggering a landmine, you must be bad at life huh?')
gamename()
elif answer == 'up'or 'Up':
print('You jump, that seems useless In a hallway, please re evaluate your life')
gamename()
elif answer == 'down'or 'Down':
print('You sit down on your dragon dildo, nice job faggot')
gamename()
elif answer != 'left'or 'Left' or 'up' or 'Up' or 'down' or 'Down'or 'right' or 'Right':
print('PICK AGAIN')
gamename()
gamename()
</code>
Also If one of you could give me the hidden knowledge of how to format code on here like everyone else I'd be happier than a gay at a circle jerk.
Bait, right?
>>55662593
you should represent u/d/r/l as 1 2 3 4 then explain that to the user so they don't have to type in an actual direction.
and your conditionals are all fucked.answer == 'right' or "Right'will always be true.
you're evaluating if answer is the inputted string is 'right' but your second expression isn't testing anything, it's just a string, which will always be true.
it should beanswer == 'right' or answer == 'Right'
>>55662593
You're calling your function recursively in every branch of your if-else block. If it always has to execute, put it after your if-else block. Also, if you just want to start from the top of your function again you don't need recursion, it unnecessarily blows up the call stack. What you want is a neverending loop withwhile True
>>55662593
I have a fealing i am just talking to a master baiter but fuck it.
You should just convert the users input to lower case then check the lower case version of each word against the input. Then all you have to write is "if answer == "left"" instead of what you have there. Also like the other anon said "if answer == "left" or "Left"" will always evaluate True.
>>55662593