On Fri, Apr 15, 2016, 7:56 PM wrote:
> On Thursday, April 14, 2016 at 1:48:40 PM UTC-7, Michael Selik wrote:
> > I suggest not worrying about sanitizing inputs. If someone provides bad
> > data, Python will do the right thing: stop the program and print an
> > explanation of what went wrong, ofte
On Thursday, April 14, 2016 at 1:48:40 PM UTC-7, Michael Selik wrote:
> On Thu, Apr 14, 2016, 7:37 PM justin walters
> wrote:
>
> > On Apr 14, 2016 9:41 AM, "Martin A. Brown" wrote:
> > >
> > >
> > > Greetings Justin,
> > >
> > > >score = sum_of_votes/num_of_votes
> > >
> > > >votes = [(72,
Thanks for the advice and the code Michael.
That's definitely a clever way to do it.
The algorithm is going to be used for a web application, so the inputs
should be sanitized for security reasons. It will be trivial to make sure
the inputs are integers and are in the correct range. I will raise
On Thu, Apr 14, 2016, 7:37 PM justin walters
wrote:
> On Apr 14, 2016 9:41 AM, "Martin A. Brown" wrote:
> >
> >
> > Greetings Justin,
> >
> > >score = sum_of_votes/num_of_votes
> >
> > >votes = [(72, 4), (96, 3), (48, 2), (53, 1), (26, 4), (31, 3), (68, 2),
> (91, 1)]
> >
> > >Specifically,
On Apr 14, 2016 9:41 AM, "Martin A. Brown" wrote:
>
>
> Greetings Justin,
>
> >score = sum_of_votes/num_of_votes
>
> >votes = [(72, 4), (96, 3), (48, 2), (53, 1), (26, 4), (31, 3), (68, 2),
(91, 1)]
>
> >Specifically, I'm wondering if this is a good algorithm for
> >weighted voting. Essentiall
Greetings Justin,
>score = sum_of_votes/num_of_votes
>votes = [(72, 4), (96, 3), (48, 2), (53, 1), (26, 4), (31, 3), (68, 2), (91,
>1)]
>Specifically, I'm wondering if this is a good algorithm for
>weighted voting. Essentially a vote is weighted by the number of
>votes it counts as. I re
Hi all,
I'm looking for feedback on the below vote weighting algorithm which
includes sample input. This is written in Python3.
def weight(votes):
"""
Takes a list of tuples in the form of '(vote %, weight)' where vote %
is the
rating that a user gave and weight is the number of votes