Function to find the Largest and Smallest Numbers in a List || Type 2 || Functions || Python

 

In this we are going to see how to build a function to to find the Largest and Smallest Numbers in a List - Type 2 of Functions in Python Programming Language.

def min_max(list):

    min = list[0]
    max = list[0]
    for i in list:
        if i < min:
            min = i
        if i > max:
            max = i
    print("Smallest : ", min, "Largest : ", max)


min_max([4, 7, 1, 11, 21, 9, 3, 5, 2, 10])
# Coded By Ashish

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post