Input 5 numbers within a list and get the maximum & minimum number from the list in Pythan

 Solution:

lst = []
num = int(input('How many numbers: '))
for n in range(num):
    numbers = int(input('Enter number '))
    lst.append(numbers)
print("Maximum element in the list is :", max(lst), "\nMinimum element in the list is :", min(lst))


OR

j=[]
for x in range(1,6):
    n=int(input("Enter "+str(x)+" no.:"))
    j.append(n)
print(j)
print("Maximum=",max(j))
print("Minimum=",min(j))



Comments