Dec-30-2018, 08:00 AM
Hi
I'm trying to take the two lowest values off a list and then stop.
So far, the two solutions I have return the same error message i.e. ValueError: min() arg is an empty sequence.
I only get this error message if using "while".
The error goes away if I use "if"...(which adds to the confusion...!)
Thoughts?
Thanks!
I'm trying to take the two lowest values off a list and then stop.
So far, the two solutions I have return the same error message i.e. ValueError: min() arg is an empty sequence.
I only get this error message if using "while".
The error goes away if I use "if"...(which adds to the confusion...!)
Thoughts?

Thanks!
scores = [2,5,52,1,5,23,5,5,6,3,3] itemsInScores = len(scores) minimumItemsInScores = len(scores) - 2 lowerValueinScores = 0 indexOfMinimumValue = 0 while itemsInScores > minimumItemsInScores : #option1 lowerValueinScores = min(scores) indexOfMinimumValue = scores.index(lowerValueinScores) scores.pop(indexOfMinimumValue) #option2 #scores.pop(scores.index(min(scores)))