Question : how to get user input of list in python
Answered by : bright-butterfly-7vxt6i2lkp7u
# number of elements
n = int(input("Enter number of elements : "))
# Below line read inputs from user using map() function
a = list(map(int,input("\nEnter the numbers : ").strip().split()))[:n]
print("\nList is - ", a)
Source : | Last Update : Mon, 11 May 20
Question : Get a list as input from user
Answered by : krishna-agarwal
# number of elements
n = int(input("Enter number of elements : "))
# Below line read inputs from user using map() function
a = list(map(int,input("\nEnter the numbers : ").strip().split()))[:n]
print("\nList is - ", a)
Source : | Last Update : Sun, 03 Jul 22