imaginaryfruit
March 28th, 2010, 10:42 PM
Hello,
I'm trying to run the following code
def inv(p):
inverses = []
for a in range(p - 1):
inverses.append(0)
for b in range (p - 1):
c = (((b+1)*(a+1)) % p
if c == 1:
inverses[a] = b
break
return inverses
print inv(5)
and I'm getting
if c == 1 :
^
SyntaxError: invalid syntax
Can anyone explain why? I'm new to Python and don't see the difference between my if statement and the examples I've seen online.
Thanks!
I'm trying to run the following code
def inv(p):
inverses = []
for a in range(p - 1):
inverses.append(0)
for b in range (p - 1):
c = (((b+1)*(a+1)) % p
if c == 1:
inverses[a] = b
break
return inverses
print inv(5)
and I'm getting
if c == 1 :
^
SyntaxError: invalid syntax
Can anyone explain why? I'm new to Python and don't see the difference between my if statement and the examples I've seen online.
Thanks!