not able to resolve this error
Not able to resolve error
Hi @kushal1998,
The code you have written is taking inputs one after another, i.e
5 # total examples
3
2
1
5
6
whereas the input format in the question is:
5
3 2 1 5 6 # they are space separated.
so, instead of this code
size = int(input()) lst = [] for i in range(size): elements = int(input()) lst.append(elements)
use this
size = int(input()) lst = [int(x) for x in input().split()]
Also, at the end of the code you are just printing the whole list. This should not be the case. You have to print all elements (not list), use this ;
for i in lst: print(i, end=" ")