[Solved]: IndexError: list assignment index out of range

y =[]
i =0
for x in range(100000):
if x%2 != 0:
y[x] = x*2
else:
y[x] = x+2

y is an empty list, but you’re attempting to write to element [0] in the first iteration, which doesn’t exist yet.

Try the following instead, to add a new element to the end of the list:

for x in range(100000):    y.append(x)