Print error? I'm really confused


#1

Ugh, this again? Again, I have to bother you guys with a simple problem.

#repl.it
#Text Adventure Game, Python Program.

print"By Christina Maverick, Ionix Game Studios"

#OUTER
def house():
      print"Greetings and welcome! Please input your player name."
      name = input("name: ")
    
      print"Your difficulty is based on how you play. Text based games are for people with a visual imagination, so there really is no difficulty."
       answer = input("The game begins. You're in a mansion, and your family seems to have left. There is a fireplace lit up. There is a staircase, and oddly, there is a crack in the fireplace, just under the fire. " #Randomly placed to see if house() is working
    if answer == "look around" or answer == "look"
      print"You look around and you see a lantern on a table. Along with it, are 2 oil jars each filled half way with oil."
    elif answer == "go up staircase" or answer == "staircase":
      print"You go up the staircase and you see two doors. Try the first door or the second door?"
      
      #INNER
      def staircase():
        if answer == "first door" or answer == "first":
          key=["key"]
          if name in key:
            print "I have the "+key+", I will unlock the first door."
          elif name in enemies:
            print"I don't have the "+key+", so I don't have the ability to open this locked door."
          else:
            print"Key? I didn't find a "+key+". I have to go find it."
          elif answer == "second door" or answer == "second":
            print"You go into the room. You see a key on the desk along with a tinderbox. "
         else:
            print"Pick a different answer..."
          staircase()
      staircase()
      
          elif answer == "go in the cavehole" or answer == "go in":
            print"You almost fall to your death! Luckily, you survive that steep fall."
        else:
            print"Great, you've confused the game, now choose what answers are given to you! >:D"
house()
#???
'''else:
            print"Please pick a different answer."
        def #():
    if answer == "#" or answer == "#":
    elif answer == "#" or answer == "#":
    else:
        print ("")
        #()'''

#()

Error:

File "", line 15
print"You look around and you see a lantern on a table. Along with it, are 2 oil jars each filled half way with oil."
^
SyntaxError: invalid syntax

I'm using CodeCademy Labs to test this and this is the error it comes up with. Please help.

EDIT The "^" is actually on the 2, not the word print. Also, when I cut and paste line 15, it also comes up with another confusing error:

File "<stdin>", line 16
    elif answer == "go up staircase" or answer == "staircase":
      ^

SyntaxError: invalid syntax
Unknown error.


#2

Since we know the error is above the carat point, it turns out to be this line... The missing colon.


#3

Make sure you clean up your code a little bit prior to submitting a post. You can see what it'll look like on the right hand side of your screen when replying or submitting a topic. I cleaned it up for you so you can see the difference in presentation for yourself :slight_smile:

~lolman


#4

Uh, thanks...

"The missing colon"

That sounds really weird, but it helped, thanks.


#5

Here's another error I can't fix, I'm using Pythoniter to check my script now, and I can't seem to figure out how to fix this.

It comes up with this error in CodeCademy Labs:

Here's the script, and uh...

repl.it

Text Adventure Game, Python Program.

print"By Christina Maverick, Ionix Game Studios"

def house():
print"Greetings and welcome! Please input your player name."
name = input("name: ")

  '''print"Your difficulty is based on how you play. Text based games are for people with a visual imagination, so there really is no difficulty."
   answer = input("The game begins. You're in a mansion, and your family seems to have left. There is a fireplace lit up. There is a staircase, and oddly, there is a crack in the fireplace, just under the fire."
if answer == "look around" or answer == "look":
  print"You look around and you see a lantern on a table. Along with it, are 2 oil jars each filled half way with oil."
elif answer == "go up staircase" or answer == "staircase":
  '''print"You go up the staircase and you see two doors. Try the first door or the second door?"

  #INNER
  def staircase():
    if answer == "first door" or answer == "first":
      key=["key"]
      if name in key:
        print "I have the "+key+", I will unlock the first door."
      elif name in enemies:
        print"I don't have the "+key+", so I don't have the ability to open this locked door."
      else:
        print"Key? I didn't find a "+key+". I have to go find it."
      elif answer == "second door" or answer == "second":
        print"You go into the room. You see a key on the desk along with a tinderbox. "
      else:
        print"Pick a different answer..."
      staircase()
  staircase()

      elif answer == "go in the cavehole" or answer == "go in":
        print"You almost fall to your death! Luckily, you survive that steep fall."
      else:
        print"Great, you've confused the game, now choose what answers are given to you! >:D"

house()

This part down here isn't right, I'm sorry. How do I make it accurate with the other parts of the code??

'''else:
print"Please pick a different answer."
def #():
if answer == "#" or answer == "#":
elif answer == "#" or answer == "#":
else:
print ("")
#()'''

()

File "", line 15
print"You go up the staircase and you see two doors. Try the first door or the second door?"
^
SyntaxError: invalid syntax

PLEASE Help, it's from the same script, except updated a little more.


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.