0

I'm trying to learn to program and I've gotten stuck on this piece of code

if 0 <= option < len(names)
    print names[option]
elif option == 99:
    quit
else:
    print "That is not a valid option!"

When trying to run the program I get a syntax error on the first print command, and I've searched for it for like an hour or two now but I just don't see what's wrong? Please help me.

9
  • Because you miss : after first if. Commented Jan 4, 2015 at 15:45
  • Hour or two... Now you are just blatantly lying, aren't you? Commented Jan 4, 2015 at 15:46
  • I've added the : after the first if statement and now it gives me a syntax error on that line of code? if 0 <= option < len(names): ^ SyntaxError: invalid syntax Commented Jan 4, 2015 at 15:50
  • 1
    why not learn the python syntax well first:) Commented Jan 4, 2015 at 15:55
  • 1
    well I had to google what an IDE is but I think the IDE I use is notepad++ Commented Jan 4, 2015 at 15:59

1 Answer 1

5
if 0 <= option < len(names):
                           ↑
Sign up to request clarification or add additional context in comments.

2 Comments

Gift for Christmas: Sexy arrow ↑
You should accept this answer and post a new question for your new problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.