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.093 X-Spam-Evidence: '*H*': 0.82; '*S*': 0.00; '(instead': 0.09; 'def': 0.10; 'received:fi': 0.16; 'wrote:': 0.17; 'subject:need': 0.17; 'work.': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'question': 0.27; 'subject:please': 0.27; 'maybe': 0.29; 'to:addr:python-list': 0.33; 'there': 0.35; 'totally': 0.36; 'should': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'received:62': 0.62; 'different': 0.63; 'email addr:gmail.com': 0.63; 'stated': 0.69; 'received:130': 0.75 Date: Fri, 11 Jan 2013 11:56:19 +0200 From: "K. Elo" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 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; format=flowed Content-Transfer-Encoding: 7bit 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357898558 news.xs4all.nl 6871 [2001:888:2000:d::a6]:43038 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36611 Hi! Since there is no stated question, I need to guess: n -= 1 (instead of "f -= 1") should work. Or maybe the question was a totally different one... -Kimmo 11.01.2013 17:35, kwakukwatiah@gmail.com wrote: > def factorial(n): > if n<2: > return 1 > f = 1 > while n>= 2: > f *= n > f -= 1 > return f > > >