Program Console Vignaankosh.com
Execution Panel
Console is empty.
Add elements using add() method is an interactive PYTHON dry run visualizer from the Sets 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.
# Add single element using add()
colors = {"Red", "Blue"}
print("Original:", colors)
# Add single element
colors.add("Green")
print("After add('Green'):", colors)
# Adding duplicate does nothing
colors.add("Red")
print("After add('Red') duplicate:", colors)
# Adding different types
numbers = {1, 2, 3}
numbers.add(4)
numbers.add(4) # duplicate - ignored
print(f"\nNumbers: {numbers}")