Creating a Program to Decompose a Number and Run a Function on that Decomposition

CTSB01 scott.moore270 at gmail.com
Fri Jul 19 02:35:06 CEST 2013


 > It's only obvious if you're using Python 3.x.  You have forgotten the 
> 
> parentheses in the call to the print() function.
> 
> 
> On the other hand, if this is Python 2.x, I have no idea.  Next time, 
> 
> please paste the actual error, not paraphrased.  The error message 
> 
> includes a traceback. and a pointer to where in the line the error was 
> 
> detected.  If it's pointing at the end of the second token, you must be 
> 
> running Python 3.x
> And since you're using that annoying googlegroups, see this:
>
> http://wiki.python.org/moin/GoogleGroupsPython
> 
> 
> -- 
> 
> DaveA

Hi Dave,

There aren't any emails in the Cc slot so I imagine that part is fine, I will definitely edit the extra quotes though I made the mistake of thinking it was just google being google.  For reference , I'm running Python 3.x.  I'll try out putting the quotes around it.   The full code is:

>>> def phi_m(x,m):
      rtn = []
      for n2 in range(0, len(x)*m - 2):
        n = n2 / m
        r = n2 - n * m
        rtn.append(m * x[n] + r * (x[n + 1] - x[n]))
        print 'n2 =', n2, ': n =', n, ' r =' , r, ' rtn =', rtn
      rtn
      
SyntaxError: invalid syntax

where the second apostrophe in 'n2 =' is marked in orange.  Thanks to everyone who's helped out so far, hopefully with some experience I'll be able sort out any syntax issues that come my way.



More information about the Python-list mailing list