1lst = [ ]
2n = int(input("Enter number of elements : "))
3
4for i in range(0, n):
5 ele = [input(), int(input())]
6 lst.append(ele)
7
8print(lst)
1#function to input list of type [cast]
2def inputList(msg,cast):
3 i = input(msg)[1:-1]
4 a = [cast(e) for e in i.split(',')]
5 return a
6#example code:
7#l = inputList("enter a list of numbers: ",int)
8#example prompt:
9#enter a list of numbers: [1,2,3,4,5]
10#expected result for l:
11#l = [1,2,3,4,5]