need help
ethanheys (38)
pls help i dont know whats wrong with the elif

You are viewing a single comment. View All
heyitsmarcus (287)

Hey @ethanheys,

You just needed to have the right indentation in your code. Remember that elif and else attach to the same indentation level, so you were doing massive if, elif and else.

So, I put the tv and lines that go with tv into their own indentation level, so that they have their own set of if, elif, and else.

This part just needed to be indented like so:

user_answer = input("are you girl or boy ").lower().strip()
if user_answer == "boy":
  tv = input("do you like tv ").lower().strip()
  if tv == "yes":
  elif tv == "no":
      no =str(input("well what do you like"))
      print('well i dont really like',no,'but ok')
      print("Error: must be yes or no")
elif user_answer == "girl":
    print("Error: must be girl or boy")

If this solves your problem, please consider marking my answer as the accepted answer. I will continue to answer questions you might have.