Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!weretis.net!feeder4.news.weretis.net!newsfeed.tele2net.at!newsfeed.utanet.at!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.86.MISMATCH!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'argument': 0.04; 'subject:How': 0.09; 'python': 0.09; '")': 0.09; 'function:': 0.09; 'loop.': 0.09; 'def': 0.10; 'iterating': 0.16; 'string:': 0.16; 'subject:several': 0.16; 'to:name:python list': 0.16; 'string': 0.17; 'wrote:': 0.17; 'ste': 0.17; 'jan': 0.18; 'input': 0.18; 'email addr:gmail.com>': 0.20; 'written': 0.20; 'trying': 0.21; 'please?': 0.22; '>': 0.23; 'header:In-Reply- To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'far.': 0.29; 'loop,': 0.29; 'case,': 0.29; 'character': 0.29; 'skip:& 10': 0.29; 'function': 0.30; 'code': 0.31; 'url:python': 0.32; 'skip:l 40': 0.33; 'to:addr:python-list': 0.33; 'tutorial': 0.33; 'skip:& 20': 0.33; 'received:google.com': 0.34; 'done': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'url:org': 0.36; 'skip:p 20': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'takes': 0.39; 'called': 0.39; 'skip:" 10': 0.40; 'subject:this': 0.84; '2013': 0.84; 'received:209.85.214.198': 0.84; 'received:mail- ob0-f198.google.com': 0.84; 'subject:times': 0.84; 'subject:you': 0.88; 'url:tutorial': 0.93 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:in-reply-to:references:date:message-id :subject:from:to:content-type:x-gm-message-state; bh=BNyRZh0oeOD/NXe8KBMVe2ngVE5ZYz/cEy6OBzmbVzw=; b=U+vkzwko2UsZv08XKNfAqmNXWzpzW0lVv8JyjE6I3f/6IPmtT2H3K/1FVyIxTgduVr i83utlIQF8+L+IiXRNNeoGBg/Ym+tDOuihBdmv4JA3NZe4P8Da7mA7Yt6IKPVO+bVIX0 ouXMNt1zp3KQv2WlqrbqO0ZC+sK+SI86731w7QQtwhlaaj8ScQy0xwHZklWzGkTiMRae we3olRn6MB/IP87f5heGfaNsWpI1EWL9wKOsdwowebfpjcmVk+iHriHZkVLfoRMkURlK ZGAZnPeWjw4tfly+WsoQv7bC+RKy2CSRHfzCB2WVph/pRzbNxrWJ7mC7H8mVQ0KQBWRz 7c3g== X-Received: by 10.182.95.133 with SMTP id dk5mr43661534obb.14.1357504762813; Sun, 06 Jan 2013 12:39:22 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <76529b4c-fbc7-4d6d-89a5-160545448ff2@googlegroups.com> References: <76529b4c-fbc7-4d6d-89a5-160545448ff2@googlegroups.com> Date: Sun, 6 Jan 2013 12:39:21 -0800 Subject: Re: How do you call a function several times in this context?? From: Benjamin Kaplan To: Python List Content-Type: multipart/alternative; boundary=14dae93b62a21e5c9604d2a4b51c X-Gm-Message-State: ALoCoQm1Rt64HCKRCheUBC33JXHn6ADvLHGwcda1qqzlzdWMYr7z5w9zZysWIB6nYVddHHM0Cg/mUM/LCrUo0mYTglA8cgxKRRm/DDREu6CIMzJp9mCQ/rHwCUjnhazEZXyieGJk0aTpZABezyEikaXWDqpHMCSpoQ== X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 72 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357505147 news.xs4all.nl 6852 [2001:888:2000:d::a6]:49611 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36284 --14dae93b62a21e5c9604d2a4b51c Content-Type: text/plain; charset=UTF-8 On Jan 6, 2013 12:33 PM, "kofi" wrote: > > Using python 3.1, I have written a function called "isEvenDigit" > > Below is the code for the "isEvenDigit" function: > > def isEvenDigit(): > ste=input("Please input a single character string: ") > li=["0","2","4", "6", "8"] > if ste in li: > print("True") > else: > print("False") > > I am now trying to write a function that takes a string as an argument and makes several calls to the isEvenDigit function in order to calculate and return the number of even digits in the string.How do i do this please? This is what i have done so far. > > def isEvenDigit2(): > number = input("Enter a digit: ") Use a loop and call the function in the body of the loop. In this case, you would use a for loop iterating over number. If you don't know how to use a for loop, I recommend you do the tutorial at http://docs.python.org/3.3/tutorial/ --14dae93b62a21e5c9604d2a4b51c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Jan 6, 2013 12:33 PM, "kofi" <ghanashirts4sale@gmail.com> wrote= :
>
> Using python 3.1, I have written a function called "isEvenDigit&q= uot;
>
> Below is the code for the "isEvenDigit" function:
>
> def isEvenDigit():
> =C2=A0 =C2=A0 ste=3Dinput("Please input a single character string= : ")
> =C2=A0 =C2=A0 li=3D["0","2","4", "6= ", "8"]
> =C2=A0 =C2=A0 if ste in li:
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 print("True")
> =C2=A0 =C2=A0 else:
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 print("False")
>
> I am now trying to write a function that takes a string as an argument= and makes several calls to the isEvenDigit function in order to calculate = and return the number of even digits in the string.How do i do this please?= This is what i have done so far.
>
> def isEvenDigit2():
> =C2=A0 =C2=A0 number =3D input("Enter a digit: ")

Use a loop and call the function in the body of the loop. In this case, = you would use a for loop iterating over number. If you don't know how t= o use a for loop, I recommend you do the tutorial at http://docs.python.org/3.3/tutorial/

--14dae93b62a21e5c9604d2a4b51c--