The first one is this:
n = int(input())
a = []
for i in range(n):
a.append(int(input()))
The second one is this:
n = int(input())
a = [0]*n
for i in range(n):
a[i] = int(input())
I have always been using first one, but the second one just came up to my mind. I don't know how append
works, but I thought the second one could be more efficient than the first one.
Can I get answer of this problem?