Re: how to calculate reputation

Discussion in 'Python' started by Joshua Landau, Jul 2, 2013.

  1. On 2 July 2013 22:43, 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.
    >
    > I am missing something here.. and that's clear.. anyone please help me on
    > it?


    It depends what you want to do.

    I suggest http://www.evanmiller.org/how-not-to-sort-by-average-rating.html.
    This aint so simple, but it's the correct way to sort by "approval".
    In fact, it's bloody confusing.

    To assume that only the "sum" approval counts, I'd not suggest {True:
    1, False: 0}. The problem is that a "downvote" then becomes pointless.
    So probably go with False as -1.


    So you'd want:

    sum((1 if vote else -1) for vote in votes)
     
    Joshua Landau, 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:
    306
    Earl Purple
    May 17, 2006
  2. Mike
    Replies:
    1
    Views:
    525
  3. Surya Kasturi

    how to calculate reputation

    Surya Kasturi, Jul 2, 2013, in forum: Python
    Replies:
    5
    Views:
    108
    Steven D'Aprano
    Jul 3, 2013
  4. Ian Kelly

    Re: how to calculate reputation

    Ian Kelly, Jul 2, 2013, in forum: Python
    Replies:
    0
    Views:
    94
    Ian Kelly
    Jul 2, 2013
  5. Mark Janssen

    Re: how to calculate reputation

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

Share This Page