Unit: Unit 3: Loops • Interactive Practice
Interactive Python programming tutorial and practice in your browser.
# Search for a target customer ID in an unsorted batch
target_id = 42
ids = [10, 25, 42, 67, 88, 99]
for current_id in ids:
print("Inspecting ID:", current_id)
if current_id == target_id:
print("Target found! Halting search immediately.")
break # Exit the loop early without checking remaining elements
print("Search concluded.")