In this article, we will learn to find the largest element from an array using the python program.
we find the largest element in an array of using in python using two methods
- Using loop
- Using max() function
Method 1: Using a loop
- First, we set the max value to the first element of the array.
- Then, we iterate the loop and check the array element is greater than the max value, if it is max, then we update the max value to the greater value of an element of the array.
- Then, lastly, we print the max value that's the largest element of an array
Method 2: Using max() function
We use the max() function to find the largest element in an array.