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. Advertising

  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. Advertising

  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. Advertising

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. K. Elo

    Re: please i need explanation

    K. Elo, Jan 11, 2013, in forum: Python
    Replies:
    0
    Views:
    128
    K. Elo
    Jan 11, 2013
  2. Karim

    Re: please i need explanation

    Karim, Jan 11, 2013, in forum: Python
    Replies:
    0
    Views:
    133
    Karim
    Jan 11, 2013
  3. Vincent Vande Vyvre

    Re: please i need explanation

    Vincent Vande Vyvre, Jan 11, 2013, in forum: Python
    Replies:
    0
    Views:
    107
    Vincent Vande Vyvre
    Jan 11, 2013
  4. Jussi Piitulainen

    Re: please i need explanation

    Jussi Piitulainen, Jan 11, 2013, in forum: Python
    Replies:
    2
    Views:
    121
  5. Karim

    Re: please i need explanation

    Karim, Jan 11, 2013, in forum: Python
    Replies:
    0
    Views:
    110
    Karim
    Jan 11, 2013
Loading...

Share This Page