Common mistake, you overlooked a parentheses, you need to close them all.
should be:
If you don't close them all python looks at the next line to find it which happened to contain "rep", which is why you didn't know what to fix.
Edit:
Your code still has errors I can't really see what you are trying to do so I can't fix it for you but I can tell you what your doing wrong.
Ok so basically the "**" can't be used with strings because if you think about it a string can't be raised to a power. Logically, 'hi' to the third power means 'hi' * 'hi' * 'hi', which makes no sense, if your looking just to multiply the words, just use "*", the result will be 'hihihi'.
Edit:
Also, you can't use "-" for strings, the only way to concatenate strings is with "+" and "*".
Code:
ran = str(random.randrange(0, 1000, 1)
Code:
ran = str(random.randrange(0, 1000, 1))
Edit:
Your code still has errors I can't really see what you are trying to do so I can't fix it for you but I can tell you what your doing wrong.
Code:
ran = str(random.randrange(0, 1000, 1)
rep = string.replace(op1, op2, ran)
xx = rep
aa = [xx+xx**2, xx+xx**3, xx+xx**4, xx-xx**2, xx-xx**3, xx-xx**4, xx**2+xx**3, xx**2+xx**4, xx**2-xx**3, xx**2-xx**4, xx**3+xx**4, xx**3-xx**4]
Ok so basically the "**" can't be used with strings because if you think about it a string can't be raised to a power. Logically, 'hi' to the third power means 'hi' * 'hi' * 'hi', which makes no sense, if your looking just to multiply the words, just use "*", the result will be 'hihihi'.
Edit:
Also, you can't use "-" for strings, the only way to concatenate strings is with "+" and "*".