I had a python text game idea but i cant get it to work. can i have some help?i Use online-python.com to viw and edit it. PLEASE HELP ME
I had a python text game idea but i cant get it to work. can i have some help?i Use online-python.com to viw and edit it. PLEASE HELP ME
The error I'm getting is "NameError: Choice1 not defined", I'm assuming Choice1 is supposed to be a function but it hasn't been defined. You could just use input(<string>) instead of writing a dedicated function (unless there is a reason you're doing that). Your next error is that you're are setting the variable "input" equal to the return of Choice1, but then using Choice1 in the if statement instead of "input". You probably should use a different name than "input", otherwise you will get an error the next time you call input(). Another problem is that you only check if the input is 'A', which won't be true if the user inputs 'a'. You can fix this by just changing the if statement to: "if <variable> == 'A' or <variable> == 'a':" Also, on line 8, you put Print instead of print. That appears to be the only problem with your code, so it should work fine after you fix those problems.
This script fixes it:
Choice1 = ''
Choice2 = ''
Choice3 = ''
Choice1 = input('Your by the ocian and see a pile of trash what do you do. A pick it up or B dont')
if Choice1 == 'A':
print('Hooray your a good person that was probably like 1 pound of trash')
else:
print('you suck, i hope you know that.')
Choice2 = input('You go swimming in the ocean and find EVEN MORE TRASH wadayado A pick it up or B dont')
if Choice2 == 'A':
print('Good job, a random dolphin gave you 50k ¥ where the dolphin get that.')
else:
print('a doplhin comes up to you with a knife and stabs you')
Choice3 = input('a HUGE pile of trash just washed onto the shore and everyone there is helping do you A help with them or B dont')
if Choice3 == 'A':
print('Gret job! everyone is happy and the police happily share their donuts')
else:
print('The police give you a unhappy glare.')
print('You happily go to the bank turn in your 50k ¥ and get 440 usd out of it')
print('You go home happily and go to bed sadified.')