You want this - enter N, and then take N the number of elements. I view your input case just like this
5 2 3 6 6 5
have it this way in Python 3.x (for Python 2.x use raw_input() instead if input() )
Python 3
n = int(input()) arr = input() # takes the whole line of n numbers l = list(map(int,arr.split(' '))) # split those numbers with space( becomes ['2','3','6','6','5']) and then map every element into int (becomes [2,3,6,6,5])
Python 2
n = int(raw_input()) arr = raw_input() # takes the whole line of n numbers l = list(map(int,arr.split(' '))) # split those numbers with space( becomes ['2','3','6','6','5']) and then map every element into int (becomes [2,3,6,6,5])
Siyaram malav
source share