150. Python Program to find the Minimum and Maximum of given numbers.
How does this program work?
- In this program you will learn about how to find the minimum and maximum of given numbers in Python.
Here is the code
def Min(a, n):
if (n == 1):
return a[0]
return min(a[n - 1], Min(a, n - 1))
def Max(a, n):
if (n == 1):
return a[0]
return max(a[n - 1], Max(a, n - 1))
a = [1, 4, 45, 6, -50, 10, 2]
n = len(a)
print("Given numbers : ")
print(a)
print("Minimum number: ",Min(a, n))
print("Maximum number: ",Max(a, n))