Use break to exit the loop as soon as the element is found
numbers = (2, 4, 6, 8, 10, 12)
x = int(input("Enter a number to search: "))
i = 0
while i < len(numbers):
if numbers[i] == x:
print("Number found at index", i)
break # stop the loop
i += 1