Video courses for company/skill based Preparation
Purchase mock tests for company/skill building
Find Largest element in an array using Python
Today we will learn how to find largest element in an array using Python Language. In this section first to find large element we have to declare an array size and store the first element value in the max variable and than loop through the array from i to the size of array and compare elements with values of the max and we find the desired result.
Enter the array size 5
Largest element in an array 87
Steps needed for finding largest element in an array with help of Python
STEP 1: Initialize an array required in the code.
STEP 2: Store first element in variable max.
STEP 3: Iterate the loop through the array from i to length of the array and compare the value of max with elements of the array.
STEP 4: If we find any element is greater than max then max will hold the value of that element.
Python Program to find in an array
size=int(input("ENTER ARRAY SIZE "))
for i in range(size):