Find the lowest number in a list (dict, array?)[SOLVED]

I created a variable called openList using the following code:

openList = []

I am going to be adding integers to this variable using .append(). There will be times when I need to retrieve the smallest integer in the variable. Is there an easy, one-step way to get that, or do I just need to iterate through them and compare them to one another?

Python provides the min function:

>>> min([4, 5, 1, 2, 10])
1

David

Is there a way to get the index of the lowest value, instead of the lowest value itself?

I just checked the python reference and looked up the min function, it doesn’t mention a way to get the index of the lowest value as the return, so I guess there isn’t one. Oh well.

[4,5,1,2,10].index(min([4, 5, 1, 2, 10])) ? :smiley:

I think that’s going to work. Thanks guys.