Skip to content
Permalink
874e7d5550
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
14 lines (14 sloc) 398 Bytes
# example-2.py
# Search and index
pet = ["dog", "cat", "rabbit", "snake", "octopus", ]
search = "buffalo"
i = 0
while i < len(pet):
if pet[i] == search:
# we would have found search in pet
print(f"We found the search term in index {i}.")
break
i += 1
else:
# We didn't find the search item in the list
print("We didn't find the search term!")