This post shows how to find the largest number in a list in Python — a fundamental exercise that's often the first step toward more advanced array problems in interviews.

Find the largest number in a list in Python:

Explanation:
We track the largest value seen so far, starting with the first element, and update it whenever we find a bigger element while looping through the rest of the list.


Python Program to Find the Largest Number in a List

numbers = [45, 22, 89, 7, 63, 90, 12]
largest = numbers[0]

for num in numbers:
    if num > largest:
        largest = num

print(f"The largest number is {largest}")

Output:

The largest number is 90

Python's built-in max() function does this in one line, but interviewers often want to see the manual logic — practice similar array problems in our Interview Prep section.