Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #49658

Re: how to calculate reputation

From Tobiah <toby@tobiah.org>
Newsgroups comp.lang.python
Subject Re: how to calculate reputation
References <mailman.4127.1372801460.3114.python-list@python.org>
Message-ID <T2IAt.5266$Jk4.4110@newsfe09.iad> (permalink)
Organization TeraNews.com
Date 2013-07-02 14:59 -0700

Show all headers | View raw


On 07/02/2013 02: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.
>
> I am missing something here.. and that's clear.. anyone please help me on it?
>
> Thanks
>
>
>

for vote in bool_votes:
	
	reputation += 2 * vote - 1


Tobiah

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to calculate reputation Surya Kasturi <suryak@ieee.org> - 2013-07-02 23:43 +0200
  Re: how to calculate reputation Tobiah <toby@tobiah.org> - 2013-07-02 14:59 -0700
    Re: how to calculate reputation Surya Kasturi <suryak@ieee.org> - 2013-07-03 00:19 +0200
    Re: how to calculate reputation Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-02 16:29 -0600
    Re: how to calculate reputation Joshua Landau <joshua.landau.ws@gmail.com> - 2013-07-02 23:27 +0100
  Re: how to calculate reputation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-03 00:18 +0000
    Re: how to calculate reputation Chris Angelico <rosuav@gmail.com> - 2013-07-03 10:26 +1000

csiph-web