[Tutor] Unique values in an array.

Rod Krause (School) rod.krause@dubbocs.com.au
Mon, 28 May 2001 12:32:25 +1000


I am trying to generate 20 unique questions for testing numeracy skills in
high school students. Assuming that I want to generate a simple question for
adding two integers eg x+y what I am doing is radnomly generating x and y
and testing to see whether this combination has already been used.  Normally
I have placed the generated x into an one array and y into another.  When
the next x is generated I test to see if it is already in the array.  If it
is it is rejected and a new integer is generated.

I am trying to find out how to read numbers into an array using Python and
then testing a new integer to see if it has been used.  The aim is to
generate 20 unique questions when the program is run.

I am not sure of array usage in Python - or maybe an alternative.  Can
anybody give me a little direction.


Thanks

Rod