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??

References <76529b4c-fbc7-4d6d-89a5-160545448ff2@googlegroups.com> <oXlGs.986803$yH4.401228@fx03.am4> <CANy1k1i5Hj5LSZ9pWsy9Y4BYKRH-Pvw50sVBjG2UT91m7xrwEA@mail.gmail.com>
Date 2013-01-06 17:01 -0500
Subject Re: How do you call a function several times in this context??
From Joel Goldstick <joel.goldstick@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.188.1357509683.2939.python-list@python.org> (permalink)

Show all headers | 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