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


Groups > comp.lang.python > #36291

Re: How do you call a function several times in this context??

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.035
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'subject:How': 0.09; 'python': 0.09; 'function:': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; '#this': 0.16; 'naming': 0.16; 'renamed': 0.16; 'subject:several': 0.16; 'string': 0.17; 'wrote:': 0.17; 'odd': 0.17; 'jan': 0.18; 'cc:2**0': 0.23; '&gt;': 0.23; 'pass': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'reflect': 0.27; 'message-id:@mail.gmail.com': 0.27; 'skip:( 20': 0.28; 'url:mailman': 0.29; 'function': 0.30; 'code': 0.31; 'url:python': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'received:74.125.82': 0.33; 'conventions': 0.33; 'function.': 0.33; 'received:google.com': 0.34; 'jason': 0.35; 'pm,': 0.35; 'received:74.125': 0.36; 'url:org': 0.36; 'test': 0.36; 'should': 0.36; 'subject:: ': 0.38; 'some': 0.38; 'header:Received:5': 0.40; 'url:mail': 0.40; 'think': 0.40; 'your': 0.60; 'skip:n 10': 0.63; 'number:': 0.65; 'subject:this': 0.84; '2013': 0.84; 'subject:times': 0.84; 'subject:you': 0.88; 'joel': 0.91; 'to:none': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=UwPWApZgpsC+a0YrgIGfNshcDpBu0318jSr8z5/M7OY=; b=plpBKPtXjw83vHj0BsglAXdurAo5Pb9PKP5OK1wsla1NCPZ7on3U+PbU0AWk+6kTto PLHcBdfC0Zxa2+YOWpN5XZcBjzcEK4kQT/fezH7lSfmjHVcepsQYZgAHZKr0KaolOx2g 3bSZu2/vRRszz2y70I1YzQONUzvNe73KM+PXM+Wo8xb/dma2YncV7aqVq0PvKiaRS2TB k1r2z+i5imSlyg2Dq1vAYGXsBo8q1zIfhQEhTCZzYrfA1IqXfDhjUyiuOZUNJ1Z8VjT/ 9tqStVCeVL4FP3t0akyULuRxDCLuYRwCXGBLgOXI2wqJ33MjbxWIRWRPngFwXJ5v26YV cTVQ==
MIME-Version 1.0
In-Reply-To <CANy1k1i5Hj5LSZ9pWsy9Y4BYKRH-Pvw50sVBjG2UT91m7xrwEA@mail.gmail.com>
References <76529b4c-fbc7-4d6d-89a5-160545448ff2@googlegroups.com> <oXlGs.986803$yH4.401228@fx03.am4> <CANy1k1i5Hj5LSZ9pWsy9Y4BYKRH-Pvw50sVBjG2UT91m7xrwEA@mail.gmail.com>
Date Sun, 6 Jan 2013 17:01:21 -0500
Subject Re: How do you call a function several times in this context??
From Joel Goldstick <joel.goldstick@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type multipart/alternative; boundary=f46d044304f861f1d004d2a5da62
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.188.1357509683.2939.python-list@python.org> (permalink)
Lines 84
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1357509683 news.xs4all.nl 6917 [2001:888:2000:d::a6]:49265
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36291

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Sun, Jan 6, 2013 at 4:33 PM, Jason Friedman <jason@powerpull.net> wrote:

> > def double(value):
> >         result
> >         return result
> >
> > number=input('type a number')
> > print (double(int(number)))
> >
>
> I think what was meant:
>
> def double(value):
>     result = 2 * value
>     return result
> --
> http://mail.python.org/mailman/listinfo/python-list
>

#get the string of numbers outside your function:

is_even
number = input("type an integer')

#Here is some code to loop through each digit

for n in number:
    is_even_digit(n)  # this function should test the number and print what
you want for odd and even

#This will pass each digit to your function.  I renamed your function to
reflect better python naming conventions



-- 
Joel Goldstick

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How do you call a function several times in this context?? kofi <ghanashirts4sale@gmail.com> - 2013-01-06 12:26 -0800
  Re: How do you call a function several times in this context?? Benjamin Kaplan <benjamin.kaplan@case.edu> - 2013-01-06 12:39 -0800
  Re: How do you call a function several times in this context?? Alister <alister.ware@ntlworld.com> - 2013-01-06 21:23 +0000
    Re: How do you call a function several times in this context?? Jason Friedman <jason@powerpull.net> - 2013-01-06 14:33 -0700
      Re: How do you call a function several times in this context?? Alister <alister.ware@ntlworld.com> - 2013-01-06 22:35 +0000
    Re: How do you call a function several times in this context?? Joel Goldstick <joel.goldstick@gmail.com> - 2013-01-06 17:01 -0500

csiph-web