DS301222 , FINDING MAX AND min from list

list1 = []
size = int(input(“Enter number of elements : “))
for i in range(size):
ele = int(input(””))
list1.append(ele)
print(list1)
max=0
min=list1[0]

for i in range(len(list1)):
if(list1[i]>max):
max=list1[i]
if (list1[i]<min):
min=list1[i]
print(max)
print (min)

4 Likes

Correct, Keep it up…

2 Likes

@DEVANSHUBISHT66 try to use if and elif and also take care of the condition when list element will be equal to value present in max and min variables.