My function prints the the index of every element in list that is divided by 2 in a given list. I want to know if there is a way to return all the indexes rather than printing?
def printEvenIndex(referenceTuple):
for i in referenceTuple:
if i % 2 ==0:
indexOfEvenIntegers = referenceTuple.index(i)
print(indexOfEvenIntegers)
return indexOfEvenIntegers
referenceTuple = (6,5,3,4,1)
print(printEvenIndex(referenceTuple))
Right now print statement prints 0 ,3 which is valid. But return function is returning 3 only. Is there a way to tell return function to return every element that is divisible by 2? I want to return all the index rather than print it.