Find maximum element in a list Dry Run in PYTHON

Find maximum element in a list is an interactive PYTHON dry run visualizer from the For programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

Find maximum element in a list Program Code

# Find maximum element in a list
n = int(input("How many numbers? "))
numbers = []

for i in range(n):
    num = float(input(f"Enter number {i+1}: "))
    numbers.append(num)

# Find maximum
max_num = numbers[0]
for num in numbers:
    if num > max_num:
        max_num = num

print(f"Maximum = {max_num}")
print(f"Using max(): {max(numbers)}")

View the complete For programs page.

Program Console Find maximum element in a list Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.