"Ken G." <beach...@insightbb.com> wrote

In any event, if a number is listed more than once, I would like to know how many times, such as 2 or 3 times. For example, '3' is listed twice within a list.

Have you looked at the count method of lists?

Something like:

counts = set(( item, mylist.count(item)) for item in mylist if mylist.count(item) > 1)

Seems to work...

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to