Sort list in ascending order Dry Run in PYTHON

Sort list in ascending order is an interactive PYTHON dry run visualizer from the Lists 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.

Sort list in ascending order Program Code

# Sort list in ascending order
numbers = [64, 34, 25, 12, 22, 11, 90]
print("Original:", numbers)

# Method 1: sort() - modifies original
numbers.sort()
print("After sort():", numbers)

# Method 2: sorted() - returns new list
numbers2 = [64, 34, 25, 12, 22, 11, 90]
sorted_list = sorted(numbers2)
print("Using sorted():", sorted_list)
print("Original unchanged:", numbers2)

View the complete Lists programs page.

Program Console Sort list in ascending order Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.