Re: how to calculate reputation

Discussion in 'Python' started by Ian Kelly, Jul 2, 2013.

  1. Ian Kelly

    Ian Kelly Guest

    On Tue, Jul 2, 2013 at 3:43 PM, Surya Kasturi <> wrote:
    > Hi all, this seems to be quite stupid question but I am "confused"..
    > We set the initial value to 0, +1 for up-vote and -1 for down-vote! nice.
    >
    > I have a list of bool values True, False (True for up vote, False for
    > down-vote).. submitted by users.
    >
    > [True, False, False, True....]
    >
    > Now to calculate the total reputation
    >
    > should I take True = +1, False=0 [or] True = +1, False=-1 ?? for adding
    > all.


    You're using False to represent a down-vote and you want down-votes to
    count as -1, so you would count a False value as -1.

    Now why don't you just use 1 and -1 to represent the votes instead of
    True and False? Then you won't need to worry about this conversion
    step.
    Ian Kelly, Jul 2, 2013
    #1
    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. Replies:
    3
    Views:
    303
    Earl Purple
    May 17, 2006
  2. Mike
    Replies:
    1
    Views:
    520
  3. Surya Kasturi

    how to calculate reputation

    Surya Kasturi, Jul 2, 2013, in forum: Python
    Replies:
    5
    Views:
    101
    Steven D'Aprano
    Jul 3, 2013
  4. Joshua Landau

    Re: how to calculate reputation

    Joshua Landau, Jul 2, 2013, in forum: Python
    Replies:
    0
    Views:
    87
    Joshua Landau
    Jul 2, 2013
  5. Mark Janssen

    Re: how to calculate reputation

    Mark Janssen, Jul 3, 2013, in forum: Python
    Replies:
    1
    Views:
    93
Loading...

Share This Page