I have this function with lists that has strings in it and I have to find the second element in this list that starts with \"b\".
for example:
second_e
Try this :
def second_elemnt_starting_with_b(list_): return [i for i in list_ if i.startswith('b')][1] print(second_elemnt_starting_with_b(["b", "a", "bb"]))
Output :
'bb'