To find largest and smallest number in a list using python programming .
firstly, we need to input elements in a list and print the output which one is largest and which one smallest .
The code is given below:
n=int(input("Enter the number of elements to be in the list:"))
for i in range(0,n):
print("largest number= ",b[n-1])
print("smallest number= ",b)
1)user must input the number of elements and elements
2) Then elements will append(to add elements in a list from left to right) in the list a .inside the for loop because to read the element in each time and to append yo the list .
3) Then shorting of list happen.obviously in the list a .the 1st position and last position is the smallest and largest number in list.and lastly print the output .