On Tue, Jul 2, 2013 at 11:59 PM, Tobiah <t...@tobiah.org> wrote:

> 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
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>


I think I didnt explain it clearly.. let me make it clear..

1. The database we are using is having BooleanField for it!! so, cant do
anything
2. I am not looking for sorting algorithms .. just simple math :) It sounds
crazy but let me describe my confusion

lets have 3 users with

[null, null, null]
reputation = 0

[T, - - ]
rept = 1

[T T T]
rept = 3

[T T F]
rept = 1 (its jumping from 3 to 1 -->but generally, we observe only
decrease in 1 right?)

[T T F]
rept = 3 (its jumping from 1 to 3)

These jumpings are common? or my logic is going any wrong?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to