Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'true,': 0.05; '(its': 0.09; 'false,': 0.09; 'logic': 0.09; 'null,': 0.09; 'cc:addr :python-list': 0.11; '11:59': 0.16; 'bool': 0.16; 'here..': 0.16; 'jumping': 0.16; 'sorting': 0.16; 'all.': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'users.': 0.18; 'all,': 0.19; 'seems': 0.21; 'cc:addr:python.org': 0.22; 'lets': 0.24; 'initial': 0.24; 'math': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'values': 0.27; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'didnt': 0.31; 'anyone': 0.31; 'quite': 0.32; 'url:python': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'crazy': 0.36; 'false': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'should': 0.36; 'so,': 0.37; 'list': 0.37; 'pm,': 0.38; 'anything': 0.39; 'explain': 0.39; 'skip:& 20': 0.39; 'users': 0.40; 'url:mail': 0.40; 'algorithms': 0.60; 'simple': 0.61; 'total': 0.65; 'jul': 0.74; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=VmE0fLBEFNPgRINoG++lylzpZ0Z8jYW2UpmfvZAdqEk=; b=Q/1hoMpaPRhLA8couMSBbSyfUgGWdIULohWCWcKyFomAdP4l78JJcoNuH3dv+g8QkQ ZnzR435ro1JU1F3izGyWbHnUHOlQXI+YTXNTSmK7cSSq70mpFIthERid2K26HFU2e4mW VWBTNFmAabwvmBHQ6OsBwgBbccbiLW9EJs7yYfu0JcxkZMGkFx8C1UTOtmKnbgzYmRP2 Ut2CMrtH9QmNwXgGmGjZHDMBIf5r8R1RGMw52qHameWTixQTi5NNR+uP9rJL1bVMuhK7 M0gQBS7HF8P/+tGcL75aqebU07RsMX+cL7+3o1eWCzNEsv5owghZZW2jvNXSh/8pte/d Vtmw== X-Received: by 10.182.87.170 with SMTP id az10mr14521702obb.10.1372803617205; Tue, 02 Jul 2013 15:20:17 -0700 (PDT) MIME-Version: 1.0 Sender: kasturisurya@gmail.com In-Reply-To: References: From: Surya Kasturi Date: Wed, 3 Jul 2013 00:19:57 +0200 X-Google-Sender-Auth: sAoHW4lRkJhUzTzcdljdQb7Rv4s Subject: Re: how to calculate reputation To: Tobiah Content-Type: multipart/alternative; boundary=089e0111bcfaf383ab04e08ebf29 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 149 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372803626 news.xs4all.nl 15924 [2001:888:2000:d::a6]:33916 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49661 --089e0111bcfaf383ab04e08ebf29 Content-Type: text/plain; charset=UTF-8 On Tue, Jul 2, 2013 at 11:59 PM, Tobiah 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 > 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? --089e0111bcfaf383ab04e08ebf29 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Tue, Jul 2, 2013 at 11:59 PM, Tobiah <toby@tobiah.org> wrote:
On 07/02/2013 02:43 PM, Su= rya 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 =3D +1, False=3D0 =C2=A0[or] True =3D +1, False=3D-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:
=C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 reputation +=3D 2 * vote - 1


Tobiah
--
http://mail.python.org/mailman/listinfo/python-list


<= /div>
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 an= ything
2. I am not looking for sortin= g algorithms .. just simple math :) It sounds crazy but let me describe my = confusion

lets have 3 users with=C2=A0

[null, null, null]=C2=A0
reputation =3D 0

[T, - - ]
rept= =3D 1

[T T T]
rept =3D 3

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

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

These jumpings are common? or my logic is going any wrong?


--089e0111bcfaf383ab04e08ebf29--