Method 8: Swap using single line input with unpacking Dry Run in PYTHON

Method 8: Swap using single line input with unpacking is an interactive PYTHON dry run visualizer from the Io 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.

Method 8: Swap using single line input with unpacking Program Code

# Method 8: Swap using single line input
print("Enter two numbers separated by space:")

# Read and swap in one line
a, b = map(int, input().split())

print(f"Original: a = {a}, b = {b}")

# Swap using tuple unpacking
a, b = b, a

print(f"Swapped: a = {a}, b = {b}")

View the complete Io programs page.

Program Console Method 8: Swap using single line input with unpacking Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.