You define the array
as an empty array (a = ), then try to assign a value to a, which does not exist yet, so the program dies with a "list assignment index out of range" error". You can either create the array with two values to start, e.g.
a = [None, None]
or use append in the for loop e.g.
for _ in range(int(input())):
a = 
accepts a prompt as an argument, why not use it? e.g.
input('How many items to add? ")
This would make it clear to anyone running the program what data is expected, rather than just a blank terminal screen. It's not known then if the program is busy, or waiting for input. But maybe you already do that, and the above snippet was just to illustrate the issue you're currently trying to resolve?