Find duplicates in a list and count them ...

D'Arcy J.M. Cain darcy at druid.net
Thu Mar 26 21:02:20 CET 2009


On Thu, 26 Mar 2009 16:00:01 -0400
Albert Hopkins <marduk at letterboxes.org> wrote:
> > l = list()
> > for i in xrange(80000):
> >     l.append(randint(0,10))
>       ^^^^^^^^^^^^^^^^^^^^^^^
> should have been:
>       l.append(randint(0,9))

Or even:

  l = [randint(0,9) for x in xrange(80000)]

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list