Algorithm design
Algorithm design
Found = False
Counter = 0
if Found:
print(f"{Name} found at position {Counter + 1} in the list.") # Position is Counter + 1 for 1-based index
else:
print(f"{Name} not found.")
while True:
Name = input("Please enter name to find (or type 'exit' to stop): ")
if Name.lower() == 'exit’:
return -1
if result != -1:
print(f"Target found at index: {result}")
else:
print("Target not found in the list.")