Python homework

Chris Angelico rosuav at gmail.com
Wed Dec 13 13:28:57 EST 2017


On Thu, Dec 14, 2017 at 3:23 AM,  <paul at lanscape.io> wrote:
> from random import randint
>
> rolls = [randint(1, 6) for x in range(50)]
> print("Average: %s" % (sum(rolls) / len(rolls)))
> print("Most Common: %s" % max(rolls, key=rolls.count))

Great demo of a bad algorithm. :)

ChrisA



More information about the Python-list mailing list