array min

Go Back home

Iterative

1 A = [0,1,0,2,1,0,1,3,2,1,2,1]
2 m = 0
3 for a in A:
4 m = min(a, m)
5 print(m)

Output:

1 0

Functional

1 from functools import reduce
2 A = [0,1,0,2,1,0,1,3,2,1,2,1]
3 m = reduce(lambda a, x: min(a, x), A)
4 print(m)

Output:

1 0

See Also

array max