I have the following series and I am supposed to pinpoint with a loop the indices that contain exactly the value 6:
x=[1, 3, 2, 1, 1, 6, 4, 2]
results=[]
Upon making my code, however, I am getting the output none. What could be going wrong?
def throwing_6(x):
for index,throw in enumerate(x):
if throw==6:
results.append(index)
results
indexes = throwing_6([1, 2, 6, 3, 6, 1, 2, 6])
print(indexes)