'code won't run: SyntaxError: bad input on line 28 in main.py
won't let me run it, have tried indenting checking indentation. If I get rid of this part it will just say it about another part. Might help if it say that if I get rid of response = "" it moves to the first response = input. Help would be appreciated, thank youQ
line 28 is as follows:
if response == "a": print("\n\na) you give them better housing. And as a result Ezry forgives you and rewards you by playing fetch with you, which by the way is your favorite game. And you play all throught the night\n\n HAPPY ENDING V2")")
yes_no = ["yes", "no"]
directions = ["left", "right", "forward", "backward"]
# Introduction_____________________________
name = input("What is your name, adventurer?\n")
print("Greetings, " + name + ". Let me tell you a story about a dog...")
# Start of game
response = ""
while response not in yes_no:
#__________________________________________
response = input("\n\nAs you wake up from your Royal slumber, you make your way over to your throne. You, princess Gracie the dog, have some work to do. But before that you must open the gates. Do you:\n a) open the gates\n b) go back to bed\n")
if response == "a":
response = input("\n\na)as you open the gates, peasent class people rush through the gates as the guards try to slow them down. But their are too many of them. Do you\n a) let them in\n b) attempt to take them on yourslef")
if response == "a":
response = input("\n\na) as you let the people in, they are pleading for help. The poeple ask for money to feed thier families. Do you\n a) give them money\n b) send them to thedungeon\n")
if response == "a":
response = input("\n\na) you give them the money, such a good puppy. Becuase of your good deeds you get some treats, keep it up and you'll be rich with treats. The next person comes up and they are asking for better housing. Do you:\n a) give them better housing\n b) make them leave\n")
if response == "a":
print("\n\na) good girl. becuase of your good deeds Ezry rewards you by playing fetch with you, which by the way is your favorite game. And you play all throught the night\n\n HAPPY ENDING")
elif response == "b":
response = input("\n\nb) you send them away, but as you do, you relize they were a golden angle in discise. But really they were a frail old lady pleading for help and now they will put a curse on this castle. do you:\n a) give her what she wants\n b) call Disney and sue this game...\n\n wait, what. No please don't pick that last one, we don't have the money for that, this will cut our buget. Please i'm begging you!"
if response == "a":
print("\n\na) you give them better housing. And as a result Ezry forgives you and rewards you by playing fetch with you, which by the way is your favorite game. And you play all throught the night\n\n HAPPY ENDING V2")")
elif response == "b":
print("\n\nb)¥øu sue †his gåm∑...
nøw we hå√∑ nø møn∑¥ †o çøntinu˜ue †hπs gåm
...\n\n Ϸ
´®†¥
¨
ˆøπåß∂ƒ©˙∆˚¬Ω≈ç√∫
˜µ¡™£¢∞§¶•ªº“‘…æ≤≥÷–≠´")
elif response == "b":
print("\n\nb) as you send them to the dudgeon and roar your evil puppy laugh. You see Ezry come around the corner and it turns out this whole thing was all pretend and you were just playing a game\n\n MAKE BELIEVE ENDING")
if response == "b":
print("\n\nb) you attempt to take them on yourself. You die from being trampled. What the heck did you expect, there are hundreds of peaseants, 'oh, look at me, im one person and I'm going to try and fight hundreds of people,' that's you.\n\n DEAD ENDING")
elif response == "b":
response = input("\n\n b) as you go back to bed you see a dragon fling past your window. Their seems to be a prisoner on the dragon. Do you\n a) go after the gragon\n b) go to bed")
if response == "a":
response = input("\n\na) as you get ready to go after the dragon, you realize that you can't fly after it. But you do have some options that could mabey let you fly. you can either use:\n a) your Majic Bone™\n b) a purple carpit
if response == "a":
response = input("\n\na) Good job... you do relise that this isn't a Disney fairy tail (im not being sarcastic, text just doesnt trasmit sarcasm very well, and I'm not a fisical entity.) As you grab the bone you fly off to fight the epic batle. As you come to the dragon, he durdles a fireball. Do you\n a) dodge left\n b) dodge right")
if response == "a":
response = input("\n\na) as you dodge left, you see a key tied to the dragons tail. Do you:\n a) go for it\n b)stand their helplessly thinking about the fun you had yesterday")
if response == "a":
response = input("\n\na) as you grab the key you see that the 'person' in the cage, isn't a person at all, its your best friend Winter the dog. Do you want to:\n a) save best friend Winter the dog\n b) abandon her")
if response == "a":
print("\n\na) you go to save your friend Winter the dog. Your viens surge with passion to save your best friend. You take out the dragon with a fierce puppy punch and go to your puppy friend and you save her. You and Winter fly off into the sunset with the power of you majic bone and play fetch with Ezry.\n\n VERY HAPPY ENDING :')
elif response == "b":
print("\n\nb) you choose to abandon your best friend... how dare you. That's cold. You go to bed crying as your best friend gets taken away by a dragon.\n\n HORRIBLE ENDING >:(")
elif response == "b":
print("\n\nb) As you stand there helpless thiking about things other than the fire ball coming towards you, a fireball so strong even your puppy cutness can't stop it comes towards and you wake up and relize it was all a dream. As you wake up crying, Ezry pets and comforts you back to sleep.\n\n DREAM ENDING")
elif response == "b":
response = input("\n\nb) as you dodge right, you see a key tied to the dragons tongue. Do you:\n a) go for it\n b) sit there thinking about your favorite puppy treats")
if response == "a":
response = input("\n\na) as you grab the key you see that the 'person' in the cage, isn't a person at all, its your best friend Winter the dog. Do you want to:\n a) save best friend Winter the dog\n b) abandon her")
if response == "a":
print("\n\na) you go to save your friend Winter the dog. Your viens surge with passion to save your best friend. You take out the dragon with a fierce puppy punch and go to your puppy friend and you save her. You and Winter fly off into the sunset with the power of you majic bone and play fetch with Ezry.\n\n VERY HAPPY ENDING :')
elif response == "b":
print("\n\nb) you choose to abandon your best friend... how dare you. That's cold. You go to bed crying as your best friend gets taken away by a dragon.\n\n HORRIBLE ENDING >:(")
elif response == "b":
print("\n\nb) As you stand there helpless thiking about things other than the fire ball coming towards you, a fireball so strong even your puppy cutness can't stop it comes towards and you wake up and relize it was all a dream. As you wake up crying, Ezry pets and comforts you back to sleep.\n\n DREAM ENDING")
elif response == "b":
response = input("\n\nb) As you'r fluffy paws grab the purple carpet, you realize that this is not a Disney fairy tail, and this is not Aladdin. So dissapointed by your outcome, you go back to bed.\n\n DISSAPOINTED ENDING")
elif response == "b":
print("\n\nb) Wow, your really boring. You go back to bed. 'that was a boring ending,' you may be thinking. Well, what were you expecting, it's a bed, you sleep in it. THere's a dragon out the window and you choose to go to bed. Wow...\n\n YOU'R BORING ENDING)
quit()```
Solution 1:[1]
In one of the lines you have one too many quotes and close parenthesis. I made a inline comment right above the line in question in another line you have mismatched single and double quotes, in another line you were missing a closing quote.
You should consider limiting your lines of code to about 80-100 characters. When you have a bunch off lines that trail of out of sight things tend to be overlooked, and it makes it very difficult to read.
yes_no = ["yes", "no"]
directions = ["left", "right", "forward", "backward"]
# Introduction_____________________________
name = input("What is your name, adventurer?\n")
print("Greetings, " + name + ". Let me tell you a story about a dog...")
# Start of game
response = ""
while response not in yes_no:
#__________________________________________
response = input("\n\nAs you wake up from your Royal slumber, "
"you make your way over to your throne. You, "
"princess Gracie the dog, have some work to "
"do. But before that you must open the gates. Do"
" you:\n a) open the gates\n b) go back to bed\n")
if response == "a":
response = input("\n\na)as you open the gates, peasent class"
" people rush through the gates as the guards"
" try to slow them down. But their are too many"
" of them. Do you\n a) let them in\n b) attempt"
" to take them on yourslef")
if response == "a":
response = input("\n\na) as you let the people in, they are"
" pleading for help. The poeple ask for money"
" to feed thier families. Do you\n a) give "
"them money\n b) send them to thedungeon\n")
if response == "a":
response = input("\n\na) you give them the money, such a good puppy. Becuase of your good deeds you get some treats, keep it up and you'll be rich with treats. The next person comes up and they are asking for better housing. Do you:\n a) give them better housing\n b) make them leave\n")
if response == "a":
print("\n\na) good girl. becuase of your good deeds Ezry rewards you by playing fetch with you, which by the way is your favorite game. And you play all throught the night\n\n HAPPY ENDING")
elif response == "b":
response = input("\n\nb) you send them away, but as you do, you relize they were a golden angle in discise. But really they were a frail old lady pleading for help and now they will put a curse on this castle. do you:\n a) give her what she wants\n b) call Disney and sue this game...\n\n wait, what. No please don't pick that last one, we don't have the money for that, this will cut our buget. Please i'm begging you!"
if response == "a": ## you had an extra quote and close parenth at the end of the next line
print("\n\na) you give them better housing. And as a result Ezry forgives you and rewards you by playing fetch with you, which by the way is your favorite game. And you play all throught the night\n\n HAPPY ENDING V2")
elif response == "b":
print("\n\nb)¥øu sue †his gåm?... ?nøw we hå?? nø møn?¥ †o çøntinu˜ue †h?s gåm?...\n\n œ??´®†¥?¨??ˆø?åß?ƒ©???¬??ç???˜µ¡™£¢?§¶•ªº“‘…æ??÷–?´")
elif response == "b":
print("\n\nb) as you send them to the dudgeon and roar your evil puppy laugh. You see Ezry come around the corner and it turns out this whole thing was all pretend and you were just playing a game\n\n MAKE BELIEVE ENDING")
if response == "b":
print("\n\nb) you attempt to take them on yourself. You die from being trampled. What the heck did you expect, there are hundreds of peaseants, 'oh, look at me, im one person and I'm going to try and fight hundreds of people,' that's you.\n\n DEAD ENDING")
elif response == "b":
response = input("\n\n b) as you go back to bed you see a dragon fling past your window. Their seems to be a prisoner on the dragon. Do you\n a) go after the gragon\n b) go to bed")
if response == "a": # you were missing close quote close paren on the next line.
response = input("\n\na) as you get ready to go after the dragon, you realize that you can't fly after it. But you do have some options that could mabey let you fly. you can either use:\n a) your Majic Bone™\n b) a purple carpit")
if response == "a":
response = input("\n\na) Good job... you do relise that this isn't a Disney fairy tail (im not being sarcastic, text just doesnt trasmit sarcasm very well, and I'm not a fisical entity.) As you grab the bone you fly off to fight the epic batle. As you come to the dragon, he durdles a fireball. Do you\n a) dodge left\n b) dodge right")
if response == "a":
response = input("\n\na) as you dodge left, you see a key tied to the dragons tail. Do you:\n a) go for it\n b)stand their helplessly thinking about the fun you had yesterday")
if response == "a":
response = input("\n\na) as you grab the key you see that the 'person' in the cage, isn't a person at all, its your best friend Winter the dog. Do you want to:\n a) save best friend Winter the dog\n b) abandon her")
if response == "a": # you have mismatched quotes on the next line
print("\n\na) you go to save your friend Winter the dog. Your viens surge with passion to save your best friend. You take out the dragon with a fierce puppy punch and go to your puppy friend and you save her. You and Winter fly off into the sunset with the power of you majic bone and play fetch with Ezry.\n\n VERY HAPPY ENDING :")
elif response == "b":
print("\n\nb) you choose to abandon your best friend... how dare you. That's cold. You go to bed crying as your best friend gets taken away by a dragon.\n\n HORRIBLE ENDING >:(")
elif response == "b":
print("\n\nb) As you stand there helpless thiking about things other than the fire ball coming towards you, a fireball so strong even your puppy cutness can't stop it comes towards and you wake up and relize it was all a dream. As you wake up crying, Ezry pets and comforts you back to sleep.\n\n DREAM ENDING")
elif response == "b":
response = input("\n\nb) as you dodge right, you see a key tied to the dragons tongue. Do you:\n a) go for it\n b) sit there thinking about your favorite puppy treats")
if response == "a":
response = input("\n\na) as you grab the key you see that the 'person' in the cage, isn't a person at all, its your best friend Winter the dog. Do you want to:\n a) save best friend Winter the dog\n b) abandon her")
if response == "a": # mismatched parenthesis at end of this line.
print("\n\na) you go to save your friend Winter the dog. Your viens surge with passion to save your best friend. You take out the dragon with a fierce puppy punch and go to your puppy friend and you save her. You and Winter fly off into the sunset with the power of you majic bone and play fetch with Ezry.\n\n VERY HAPPY ENDING :")
elif response == "b":
print("\n\nb) you choose to abandon your best friend... how dare you. That's cold. You go to bed crying as your best friend gets taken away by a dragon.\n\n HORRIBLE ENDING >:(")
elif response == "b":
print("\n\nb) As you stand there helpless thiking about things other than the fire ball coming towards you, a fireball so strong even your puppy cutness can't stop it comes towards and you wake up and relize it was all a dream. As you wake up crying, Ezry pets and comforts you back to sleep.\n\n DREAM ENDING")
elif response == "b":
response = input("\n\nb) As you'r fluffy paws grab the purple carpet, you realize that this is not a Disney fairy tail, and this is not Aladdin. So dissapointed by your outcome, you go back to bed.\n\n DISSAPOINTED ENDING")
elif response == "b": # missing paranthesis at end of next line
print("\n\nb) Wow, your really boring. You go back to bed. 'that was a boring ending,' you may be thinking. Well, what were you expecting, it's a bed, you sleep in it. THere's a dragon out the window and you choose to go to bed. Wow...\n\n YOU'R BORING ENDING")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |