I have a list of integers. I want to know whether the number 13 appears in it and, if so, where. Do I have to search the list twice, as in the code below?
if 13 in intList:
i = intList.index(13)
In the case of dictionaries, there's a get
function which will ascertain membership and perform look-up with the same search. Is there something similar for lists?