[Tutor] Removing duplicates in a list with a fixed length of items in the list.

Adam Cripps kabads at gmail.com
Thu Jan 11 15:19:48 CET 2007


I have a list which comprises of simple random arithmetic problems for
teachers to give to their pupils. This list must be a set length (if
the teacher asks for 10 questions, they should get 10 questions), but
should not have any duplicates.

I've seen the use of sets, but this reduces the size of the list, when
I have to have a fixed length.

Is there a quick way of checking if a string is already within a list
without iterating over the items of the list (which will slow the
application down slightly)?

TIA
Adam
-- 
http://www.monkeez.org
PGP key: 0x7111B833


More information about the Tutor mailing list