Find shared hobbies & missing elements Dry Run in PYTHON

Find shared hobbies & missing elements 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.

Find shared hobbies & missing elements Program Code

# Find shared hobbies and missing elements
person1 = {"reading", "swimming", "coding", "gaming"}
person2 = {"coding", "gaming", "hiking", "photography"}

print("Person 1 hobbies:", person1)
print("Person 2 hobbies:", person2)

# Shared hobbies (Intersection)
shared = person1 & person2
print(f"\nShared hobbies: {shared}")

# Hobbies only in person1
only_p1 = person1 - person2
print(f"Only Person 1: {only_p1}")

# All distinct hobbies (Union)
all_hobbies = person1 | person2
print(f"\nAll distinct hobbies: {all_hobbies}")

# Find missing elements from a complete set
complete = {"reading", "swimming", "coding", "gaming", "hiking", "photography", "dancing"}
missing_from_p1 = complete - person1
print(f"\nHobbies Person 1 is missing: {missing_from_p1}")

missing_from_p2 = complete - person2
print(f"Hobbies Person 2 is missing: {missing_from_p2}")

View the complete Sets programs page.

Program Console Find shared hobbies & missing elements Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.