Write a program to find the maximum of a list of numbers


Write a program to find the maximum of a list of numbers
.
  1. def Max(*lst):
        lst=lst[0]
        temp=lst[0]
        for item in lst[1:]:
            if temp<item:
                temp=item
        return temp
    elements=[]
    num_of_elmenets=int(input("how many elment you want to Enter: "))
    for i in range(num_of_elmenets):
        elm=int(input("Enter element "))
        elements.append(elm)
    print("The maximum element is ")
    print(Max(elements))

Output:-


Post a Comment

0 Comments