[Tutor] invalid syntax
Gregor Lingl
glingl at aon.at
Thu Feb 12 18:57:00 EST 2004
Christopher Spears schrieb:
> elif:
> file_size[b][1] == files_size[b+1][1]:
> biggest_files = biggest_files + file_size[b][1] + file_size[b][1]
> else:
> biggest_files = biggest_files +
>files_size[b+1]
>
>
>
>
You have to put another boolean expression between "elif" and ":"
elif means: else if ... . So if *what*?
Ah' a closer look to your code reveals: this file_size[b][1] == ....
comparison should
immediately follow the elif. (Right?) . So simply delete the : and
put the comparison
on line up.
Only if you don't have to check any more conditions,
else:
suffices.
HTH, Gregor
> print files_size
> print biggest_files
>
>According to Python, the : after the elif is causing
>an invalid syntax error. What gives?! I thought I
>was supposed to include that colon.
>
>-Chris
>
>_______________________________________________
>Tutor maillist - Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>
>
>
More information about the Tutor
mailing list