On Wed, 05 Jan 2005 15:36:30 +0900, Daewon YOON wrote: > ==== > Python 1.5.2 (#1, Jul 5 2001, 03:02:19) [GCC 2.96 20000731 (Red Hat > Linux 7.1 2 on linux-i386 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> x=9 > >>> y=4 > >>> x%y > 1 > >>> for z in range(44): > ... z%9 > File "<stdin>", line 2 > z%9 > ^ > SyntaxError: invalid syntax > > ==== > What's wrong with the above operation and how can I get the correct > modulo result with Python?
There's nothing wrong with the operation, but it looks like you forgot to indent your loop body (which the interactive shell doesn't automagically do for you): >>> for z in range(44): ... z%9 ... [result snipped] -- Christopher raise OutofSigError -- http://mail.python.org/mailman/listinfo/python-list