It's not clear if you're using proper indentation here. I recommend putting your code on a paste site (e.g. http://pastebin.com/ ) so we can see the whitespace properly. Here's a more complete version of your example, which does work once a line after the elif is added:
http://pastebin.com/4L2wfKdr It's not clear to me here; were you just typing this code directly into the Python interpreter (e.g. by running "python" on the command line)? If so, I think I know what happened: your elif statement had the same level of indentation as the "print" statement. That means that you had an elif statement without a preceding if statement, which is indeed a syntax error. You need to back the elif statement out to the same level of indentation as the if statement. Hope this helps. -Chris On Wed, Aug 10, 2011 at 7:43 AM, Doychin Stanchev <doichi...@gmx.de> wrote: > Hi guys, > I am really new to the programming and I decided to start with python. I > found a book called "beginning python" and started to learn, but I had a > problem with the command "elif". I am running 10.7 and python 2.72. Here is > my problem: >>>> milk_price = 1.50 >>>> if milk_price < 1.25: > print "Buy two cartons of milk, they're on sale" > elif milk_price < 2.00: > > SyntaxError: invalid syntax > I'll appreciate very much your help, > Thank you, > Doychin > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > > _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG