Re: [Tutor] Removing duplicates

2018-08-02 Thread Oscar Benjamin
On 2 August 2018 at 13:49, Peter Otten <__pete...@web.de> wrote: > Oscar Benjamin wrote: >> >> Comparing floats for equality can be flakey. Sometimes two floats that >> should be equal will not compare equal e.g.: >> > 0.01 + 0.1 - 0.1 == 0.01 >> False > > Do you know if there's a way to

Re: [Tutor] Removing duplicates

2018-08-02 Thread Peter Otten
Oscar Benjamin wrote: > On 1 August 2018 at 21:38, Roger Lea Scherer wrote: >> >> I'm trying to get a list of tuples to be a float, a numerator, and a >> denominator for all the fractions: halves, thirds, fourths etc up to >> ninths. 1/2 returns the same float as 2/4, 3/6, 4/8. I would like to

Re: [Tutor] Removing duplicates

2018-08-02 Thread Oscar Benjamin
On 1 August 2018 at 21:38, Roger Lea Scherer wrote: > > I'm trying to get a list of tuples to be a float, a numerator, and a > denominator for all the fractions: halves, thirds, fourths etc up to > ninths. 1/2 returns the same float as 2/4, 3/6, 4/8. I would like to keep > only the 1/2. When I

[Tutor] Removing duplicates

2018-08-02 Thread Roger Lea Scherer
I'm trying to get a list of tuples to be a float, a numerator, and a denominator for all the fractions: halves, thirds, fourths etc up to ninths. 1/2 returns the same float as 2/4, 3/6, 4/8. I would like to keep only the 1/2. When I try (line 18) to "pop" from the list I get a "TypeError: integer

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

2007-01-11 Thread Adam Cripps
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

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

2007-01-11 Thread Kent Johnson
Adam Cripps wrote: 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

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

2007-01-11 Thread Adam Cripps
On 1/11/07, Adam Cripps [EMAIL PROTECTED] wrote: On 1/11/07, Kent Johnson [EMAIL PROTECTED] wrote: Adam Cripps wrote: 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

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

2007-01-11 Thread Kent Johnson
Adam Cripps wrote: I've not worked with Sets before but will give it a go. Is there a way of turning the Set back to a list? list(mySet) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

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

2007-01-11 Thread Klaus Ramelow
Why not sorting the items and throw out all multiples until you reach the fixed length ? Klaus Ramelow ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor