Jason H. answered 03/31/19
Tutor
New to Wyzant
Experienced professional working at big tech company
def get_idx(key):
try:
return [idx for idx, ele in enumerate(list) if ele == "bar"][0]
except IndexError:
return None
list = ["foo", "bar", "baz"]
print(get_idx("bar"))