[Pythonmac-SIG] "elif" problem
Henning Hraban Ramm
hraban at fiee.net
Wed Aug 10 17:15:03 CEST 2011
Am 2011-08-10 um 16:43 schrieb Doychin Stanchev:
> 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 can’t tell if you used the right spacing, and there must come at
least one command in your elif branch. E.g.:
if price < 1.25:
print "on sale"
elif price < 2.00:
pass
Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)
More information about the Pythonmac-SIG
mailing list