user87086
0
Q:

taking input of array in python

# 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
x=[int(input()) for i in range(int(input("How many elements are in list : ")))] print(x) 
1

New to Communities?

Join the community