Â
In this we are going to see how to build a function to to find the Largest and Smallest Numbers in a List - Type 3 of Functions in Python Programming Language.
def min_max():
l = []
list = [4, 7, 1, 11, 21, 9, 3, 5, 2, 10]
min = list[0]
max = list[0]
for i in list:
if i < min:
min = i
if i > max:
max = i
return min, max
small, large = min_max()
print("Smallest : ", small, "Largest : ", large)
# Coded by Saahil Shaikh
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP