Before Anything this is my first time asking a question here so if there's Something wrong with the format of the question I'm sorry about that.
So basically This is a code that is supposed to get a list of numbers, and a number from user and check to see if the second input is equal to any of the elements of the list, then put those element index numbers in a new list and print it.
The thing is the error is saying 'a' is not defined but if I define it before the for loop like this:
a=[]
or
a=list()
I get this:
a[k]= c
IndexError: list assignment index out of range
Here's the code:
x = eval(input('list'))
y = eval(input('number'))
k=0
c=0
for i in x:
if y==i:
a[k]= c
k+=1
c+=1
print(a)