% operation

D

Daewon YOON

====
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.... 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?
 
C

Christopher Koppler

====
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... 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):
.... z%9
....

[result snipped]
 
R

Rick Holbert

It also looks like you are using an old version of Python running on an old
version of Linux. Time to upgrade?

Christopher said:
====
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):
... z%9
...

[result snipped]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top