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

THE ERROR WAS A COUPLE LINES ABOVE;FIXED


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."
   exit()
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
Laptop w/ Ubuntu 14.04
Steam; PSN
mckryall
 
Posts: 101
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.
hansn
 
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.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1501
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY


Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot] and 5 guests