Program Console Vignaankosh.com
Execution Panel
Console is empty.
Check element existence using 'in' operator 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.
# Check membership using 'in' operator
fruits = {"Apple", "Banana", "Cherry", "Mango", "Orange"}
print("Set:", fruits)
# Check if element exists
print(f"Is 'Apple' in set? {'Apple' in fruits}")
print(f"Is 'Grape' in set? {'Grape' in fruits}")
print(f"Is 'Kiwi' NOT in set? {'Kiwi' not in fruits}")
# Membership is O(1) - very fast!
search = input("\nEnter fruit to search: ")
if search in fruits:
print(f" {search} found in set!")
else:
print(f" {search} not found")
# Example with numbers
nums = {1, 2, 3, 4, 5}
print(f"\n3 in nums: {3 in nums}")
print(f"10 in nums: {10 in nums}")