Daniel
0
Q:

get list input from user in python

a = list(map(int,input("\nEnter the numbers : ").strip().split()))
4
# 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)
5
# creating an empty list 
lst = [] 
  
# number of elemetns as input 
n = int(input("Enter number of elements : ")) 
  
# iterating till the range 
for i in range(0, n): 
    ele = int(input()) 
  
    lst.append(ele) # adding the element 
      
print(lst) 
3
x=[]  for i in range(int(input("How many elements are in list : "))):  x.append(int(input())) print(x) 
1

New to Communities?

Join the community