Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50877
| References | (3 earlier) <mailman.4846.1374185582.3114.python-list@python.org> <f1f2e742-af88-45b8-a585-d1c6cc239e6f@googlegroups.com> <mailman.4849.1374187752.3114.python-list@python.org> <8c5f6217-0029-481f-9bb0-dab1b34180df@googlegroups.com> <CALwzidmcVqLnr=YG5WmZsqvd0SxveruCRz8MrJXYf7d-pZ4avQ@mail.gmail.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2013-07-18 17:45 -0600 |
| Subject | Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4851.1374191199.3114.python-list@python.org> (permalink) |
On Thu, Jul 18, 2013 at 5:42 PM, Ian Kelly <ian.g.kelly@gmail.com> wrote: > On Thu, Jul 18, 2013 at 5:04 PM, CTSB01 <scott.moore270@gmail.com> wrote: >> Thanks Ian. That worked regarding that issue. Now I have an 'invalid syntax' issue unfortunately. >> >>>> 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 >> >> on the line print 'n2 =', n2, ': n =', n, ' r =' , r, ' rtn =', rtn Is it something obvious? > > Are you using Python 2 or 3? "print" has changed from a statement to > a function, so the above syntax would be invalid in Python 3. Note also that in Python 3 you should change the line "n = n2 / m" to "n = n2 // m" because the syntax for integer division has also changed. And regardless of your Python version, the last line should probably be "return rtn", not just "rtn".
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Creating a Program to Decompose a Number and Run a Function on that Decomposition CTSB01 <scott.moore270@gmail.com> - 2013-07-17 16:58 -0700
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition Joshua Landau <joshua@landau.ws> - 2013-07-18 10:12 +0100
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition CTSB01 <scott.moore270@gmail.com> - 2013-07-18 14:57 -0700
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition Gary Herron <gherron@digipen.edu> - 2013-07-18 15:12 -0700
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition CTSB01 <scott.moore270@gmail.com> - 2013-07-18 15:18 -0700
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-18 16:49 -0600
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition CTSB01 <scott.moore270@gmail.com> - 2013-07-18 16:04 -0700
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-18 17:42 -0600
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-18 17:45 -0600
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition CTSB01 <scott.moore270@gmail.com> - 2013-07-18 17:25 -0700
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2013-07-19 00:48 +0100
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition Dave Angel <davea@davea.name> - 2013-07-18 19:49 -0400
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition CTSB01 <scott.moore270@gmail.com> - 2013-07-18 17:35 -0700
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition Dave Angel <davea@davea.name> - 2013-07-18 21:04 -0400
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition CTSB01 <scott.moore270@gmail.com> - 2013-07-18 19:16 -0700
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition Dave Angel <davea@davea.name> - 2013-07-18 22:43 -0400
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition CTSB01 <scott.moore270@gmail.com> - 2013-07-18 19:56 -0700
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition Fábio Santos <fabiosantosart@gmail.com> - 2013-07-19 03:48 +0100
Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition CTSB01 <scott.moore270@gmail.com> - 2013-07-18 19:54 -0700
csiph-web