top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

how to calculate reputation in python

0 votes
21 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 Google+ Share Button LinkedIn Share Button Multiple Social 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
–1 vote

R has the function edit() which allows the editing of the definition of a function. Does python have something similar so that users can edit python functions on the fly?

Ref:
https://www.rdocumentation.org/packages/utils/versions/3.4.3/topics/edit

+2 votes
win32api.keybd_event(code,0,0,0)
time.sleep(2)
win32api.keybd_event(code,0,win32con.KEYEVENTF_KEYUP,0)

Above code is simulating single click on button but not press Key Hold but I want to hold the until key up event is called
eg: for key 'a' down it have to simulate key continous set until keyUp is called but not like "a"

Please specify any python API to simulate continues keyDown until it receives keyUp event

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...