Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'url:launchpad': 0.05; 'def': 0.10; 'from:addr:swing.be': 0.16; 'from:addr:vincent.vandevyvre': 0.16; 'from:name:vincent vande vyvre': 0.16; 'message-id:@swing.be': 0.16; 'oqapy': 0.16; 'paqager': 0.16; 'received:mobistar.be': 0.16; 'url:oqapy': 0.16; 'url:paqager': 0.16; 'url:qarte': 0.16; 'v.v.': 0.16; '\xe9crit': 0.16; 'subject:need': 0.17; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'guess': 0.27; 'subject:please': 0.27; 'to:addr:python-list': 0.33; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'email addr:gmail.com': 0.63; 'received:80.12': 0.65 Date: Fri, 11 Jan 2013 11:11:17 +0100 From: Vincent Vande Vyvre User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: python-list@python.org Subject: Re: please i need explanation References: <2FB5A66FD91D456BBDFCC0AE25760392@favour> In-Reply-To: <2FB5A66FD91D456BBDFCC0AE25760392@favour> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357899535 news.xs4all.nl 6958 [2001:888:2000:d::a6]:50509 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36613 Le 11/01/13 16:35, kwakukwatiah@gmail.com a écrit : > def factorial(n): > if n<2: > return 1 > f = 1 > while n>= 2: > f *= n > f -= 1 > return f > > > I guess you mean: f = 1 while n>= 2: f *= n n -= 1 return f Try it. -- Vincent V.V. Oqapy . Qarte . PaQager