I'm making a python text adventure game, and I'm getting an error with the choice system I made


so I’m making a python "choose your own adventure" text game. and the choice system is outputting a confusing error, I’m fairly new to python, and my question is most likely silly and an easy fix, but I don’t get it. my error is an invalid syntax error, the speccific error is File "main.py", line 17 elif answer == "b": ^ SyntaxError: invalid syntax
my code is

import os
import random
room = random.randrange(100,400)
print("                                    --------THE HOTEL--------")
answer = input("                                   < Press enter to continue >")
print("You enter the hotel, its storming outside")
print("the receptionist, a girl with black hair and brown eyes says hi to you.")
print("Your reserved room is number",room) 
print("  ")
answer = input("(A): Thanks!                                                                                                     (B): Your cute                                                                                                                          (C): ...")
if answer == "a":
   print("You: Thanks!")
   print("no problem!")
   elif answer == "b":

I know it has something to do with my if/elif statements I don’t know if I was supposed to turn the elif into an if or not, but I can’t figure it out.

Asked By: TurnipYossarian



The elif statement should have the same indentation as the if statement above.

Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.