Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50877

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

Path csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed0.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'syntax': 0.04; 'function,': 0.09; 'subject:Function': 0.09; 'subject:Number': 0.09; 'python': 0.11; 'def': 0.12; '2):': 0.16; 'ian.': 0.16; 'range(0,': 0.16; 'subject: \n ': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'issue.': 0.22; 'print': 0.22; 'integer': 0.24; 'regardless': 0.24; 'header:In-Reply-To:1': 0.27; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'changed.': 0.31; 'division': 0.31; 'subject:that': 0.31; 'probably': 0.32; 'worked': 0.33; 'something': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'should': 0.36; 'version,': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'changed': 0.39; 'skip:u 10': 0.60; 'ian': 0.60; 'invalid': 0.68; 'jul': 0.74; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=I7qqtAV2E9+VYqrLktzMfUMdbjhbdsO0uUePUPD/Hy4=; b=vs7x6A2B5NQsbCAygGjGxfQfbaQmhYRoORhAK8nSL5jYOAUwj1owXsqIX2rODDYuTH f1Wo7kg/TJdHFTFP7qPFyuasJJq3122DuTOG2oBjzB5Sc73IJoH9c1TI2Wol3peZ1xdL O5a+evp1RCjKa1gKso7VM7x1p/PKfNADcKbDdH5yP9A+tT2Zz4TJFq07s8LZnzjbVwEx gJuBSEtK4I+RZLHLmqLE/FAEnxeoOhhf/bH9De0Cdqx/RfDw4+8uDbH5NEW8BsJvSRey T6lwqakWRdzvwiSYV9kQAuBAzY0S28g6sqsUlGOOsiAJouuFIuPJ/yI3IVxIBMKa6F8b E84Q==
X-Received by 10.52.171.80 with SMTP id as16mr4122052vdc.81.1374191190186; Thu, 18 Jul 2013 16:46:30 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CALwzidmcVqLnr=YG5WmZsqvd0SxveruCRz8MrJXYf7d-pZ4avQ@mail.gmail.com>
References <8a23cbf1-3cfd-48e3-a460-64551119fde7@googlegroups.com> <mailman.4835.1374138776.3114.python-list@python.org> <537e9d19-6587-4773-8910-df4005505653@googlegroups.com> <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 Thu, 18 Jul 2013 17:45:49 -0600
Subject Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4851.1374191199.3114.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1374191199 news.xs4all.nl 15874 [2001:888:2000:d::a6]:49044
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:50877

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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