Function returning multiple collections Dry Run in PYTHON

Function returning multiple collections is an interactive PYTHON dry run visualizer from the Functions 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.

Function returning multiple collections Program Code

def analyze_list(lst):
    """Return list, tuple, set from input"""
    squared = [x**2 for x in lst]
    cubed_tuple = tuple(x**3 for x in lst)
    unique = set(lst)
    return squared, cubed_tuple, unique

nums = [1, 2, 2, 3, 3, 4]
sq, cu, un = analyze_list(nums)
print(f"Original:    {nums}")
print(f"Squared:     {sq}")
print(f"Cubed tuple: {cu}")
print(f"Unique set:  {un}")

View the complete Functions programs page.

Program Console Function returning multiple collections Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.