Finding largest in list elements in Python.

Largest in List of Python

This program is to find the largest among the list elements using for loop. Logic here is to store first element in variable called large and iterate the rest of the elements using for loop from 1 to length of list. Now check if the element found is greater then the variable large then assign the current element value in large and continue the same.

Program to find largest among the list elements.

Output of this will look like this. –

List elements are – [4, 5, 3, 2, 5, 7, 9, 1]
Largest element in list is – 9

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>