this is my code so far
print("L = ",[4,10,4,2,9,5,4])
Startlist = [4,10,4,2,9,5,4]
usrinput = int(input("Enter an element to search for in the list: "))
for i in [i for i,x in enumerate(Startlist) if x == usrinput]:
print(i)
I'm trying to however make a new list from the for loops printed numbers.This is the sample run i got by entering 4
L = [4, 10, 4, 2, 9, 5, 4]
Enter an element to search for in the list: 4
0
2
6
how could i turn the 0 2 6 into [0,2,6]?
Thanks for any responses
[i for i,x in enumerate(Startlist) if x == usrinput]