INTERVIEW QUESTION 8 How to get Biggerst number and Smallest number in a list using PYTHON
Hi everyone, in this video am going to explain How to find largest number and samllest number in a list using PYTHON,
Note: this vidoe is for beginners,
lets start the code,
Take one empty list
Now read value from keyboard,to know how numbers you want in list,
Now take one for loop to read number of Elements in list,
am storing all numbers which are read from keyboard in variable x,
again read numbers from keyboard for list,
Now add each number to list l,
Here append method is used to add elements to list,
Once adding is done, sort the Elements in list,
After sorting,print biggest number,
In a list once you sort the Elements,it will automatically arrange all Elements in ascending order it means from small Number to big Number,
Here our requirement is take last value from the sorted list,
that is lastnumber-1, apply same logic in print function,
lets run the code to know Biggest Number
like this if you want to print samllest Number in a list,
we need to pick first number which is already sorted of a list,
in list first Number is start at index 0,so write code with l[0]
Now run the code,
we got samllest Number in list,
THANK YOU FOR WATCHING THIS VIDEO,
l=[]
n=int(input('Number of Elements in list:'))
for x in range(1,n+1):
s=int(input('Enter number:'))
l.append(s)
l.sort()
print ('Biggest number is ',l[n-1])
print ('samllest number is ',l[0])
biggest number in a list in python alphabetically
biggest number in a list in python append
biggest number in a list in python code
biggest number in a list in python example
biggest number in a list in python numerically
biggest number in a list python
find biggest number in a list python
find the largest number in a list in python
how to find the biggest number in a list in python
maximum number in a list in python
On this page of the site you can watch the video online Python Tutorial - How to get Biggest number and Smallest number in a list using PYTHON with a duration of hours minute second in good quality, which was uploaded by the user Appanna Damu 04 October 2017, share the link with friends and acquaintances, this video has already been watched 339 times on youtube and it was liked by 9 viewers. Enjoy your viewing!