top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

how to calculate reputation in python

0 votes
266 views

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 thats clear.. anyone please help me on it?

posted Jul 2, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
 
Best answer

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)

answer Jul 2, 2013 by anonymous
+1 vote

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.

answer Jul 2, 2013 by anonymous
Similar Questions
0 votes

I'm new to Django. Is there any tell how to add a limit filter in Django?

0 votes

I'm new to python. Can anyone help for thread process in python?

0 votes

I need to print the Dictionary in a detailed way.

Current When am print the dictionary am getting like below.

<Details.Value: object at 0x0000027062245160>
0 votes

Is there any command available to view the installed libraries. Please suggest.

...