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

Facebook Login
Site Registration
Print Preview

how to calculate reputation in python

0 votes
17 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
+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

+2 votes

I would like to download a file. If the connection is OK, I can download the file with:

import urllib.request
urllib.request.urlretrieve(remote_file, local_file)

Sometimes when I am connected on week wireless (not mine) network I get WinError 10054 exception (windows 7). When it happens, I would like to resume download instead of doing everything from very beginning.

How to do that? I read about Range header and chunks, but this server doesn't have any headers.
What options do I have with this particular file?

+1 vote

I read the online help about string. It lists string constants, string formatting, template strings and string functions. After reading these, I am still puzzled about how to use the string module.

Could you show me a few example about this module?

+1 vote

I want my thread to be killed when I receive a particular message from Master.(I want my thread to stop whatever it is doing and come out.)

I tried few things but not working,
1) thread_name.exit()
2) thread_name.daemon = True

Any other way?


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.
QUERY HOME
...