Can you tell what's wrong here?

# cook your dish here
a = []
i = 0
while True:
    a[i] = int(input())
    if a[i]==42:
        break
    i=i+1
for j in a:
    print(a[j])

https://www.codechef.com/problems/TEST

This should work

for j in a:
   print(j)

i had to print the element at jth index of a[].
and though it worked out by printing each input as soon as received, I don’t know if there was something wrong with the question
here’s the link for the solution:
https://www.codechef.com/viewsolution/53306563