if in []: syntax error

This is the place for queries that don't fit in any of the other categories.

if in []: syntax error

Postby mckryall » Tue Dec 24, 2013 7:21 am


I am rewriting an old script to get away from C, and I get a syntax error on the second line. Code:
Code: Select all
twopq = raw_input("Do you have two ordered pairs?\n> ")
if twopq.lower() in ['n', 'no']:
   print "Why are you using slope-intercept form? Get out."
elif twopq.lower() in ['y', 'yes']:
   print "Good."

I can't find anything wrong with that.
Last edited by Mekire on Tue Dec 24, 2013 3:53 pm, edited 1 time in total.
Reason: Lock.
Python 2.7
Mac Mini (Desktop/server)
Macbook Air
Laptop w/ Ubuntu 14.04
Posts: 116
Joined: Sat Nov 23, 2013 6:13 pm

Re: if in []: syntax error

Postby hansn » Tue Dec 24, 2013 8:44 am

Always post your full traceback/error message.

If the topic of the thread represents part of the traceback, 'if in []' is not valid python.
Posts: 87
Joined: Thu Feb 21, 2013 8:46 pm

Re: if in []: syntax error

Postby metulburr » Tue Dec 24, 2013 2:02 pm

You should post the problem and how you fixed it, to help future users.
we will be moving to python-forum.io on October 1 2016
more details here
User avatar
Posts: 2244
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 7 guests