please i need explanation

Discussion in 'Python' started by kwakukwatiah@gmail.com, Jan 11, 2013.

  1. Guest

    def factorial(n):
    if n<2:
    return 1
    f = 1
    while n>= 2:
    f *= n
    f -= 1
    return f
     
    , Jan 11, 2013
    #1
    1. Advertisements

  2. Hans Mulder Guest

    On 11/01/13 16:35:10, wrote:
    > def factorial(n):
    > if n<2:
    > return 1
    > f = 1
    > while n>= 2:
    > f *= n
    > f -= 1


    U think this line should have been:

    n -= 1

    > return f



    Hope this helps,

    -- HansM
     
    Hans Mulder, Jan 11, 2013
    #2
    1. Advertisements

  3. Walter Hurry Guest

    On Sun, 13 Jan 2013 15:04:34 -0600, Tony the Tiger wrote:

    > On Fri, 11 Jan 2013 09:35:10 -0600, kwakukwatiah wrote:
    >
    >> <HTML><HEAD></HEAD>
    >> <BODY dir=ltr>
    >> <DIV dir=ltr>
    >> <DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
    >> <DIV>def factorial(n):</DIV>

    >
    > Right, another html junkie, on windoze, no doubt.


    X-Mailer: Microsoft Windows Live Mail 15.4.3508.1109
     
    Walter Hurry, Jan 13, 2013
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. D R E
    Replies:
    0
    Views:
    358
    D R E
    Jul 13, 2004
  2. exquisitus
    Replies:
    4
    Views:
    8,651
    Patricia Shanahan
    May 6, 2005
  3. KK
    Replies:
    2
    Views:
    1,061
    Big Brian
    Oct 14, 2003
  4. Buck Rogers

    explanation of a program required please

    Buck Rogers, Dec 23, 2003, in forum: C Programming
    Replies:
    6
    Views:
    533
    Joona I Palaste
    Jan 5, 2004
  5. Erik Lind

    __init__ explanation please

    Erik Lind, Jan 13, 2008, in forum: Python
    Replies:
    30
    Views:
    1,061
  6. JimLad

    Timeout explanation please?

    JimLad, Feb 7, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    805
    bruce barker
    Feb 7, 2008
  7. Dave Saville

    Regx explanation please

    Dave Saville, Jul 26, 2012, in forum: Perl Misc
    Replies:
    5
    Views:
    475
    Dave Saville
    Jul 27, 2012
  8. Jussi Piitulainen

    Re: please i need explanation

    Jussi Piitulainen, Jan 11, 2013, in forum: Python
    Replies:
    2
    Views:
    202
Loading...