Sohna
0
Q:

Write a program that takes a list of numbers as input and do the following

#to get integer list
integer_list = list(map(int, input().split()))
#to get char or str list, just replace int with str
str_list = list(map(str, input().split()))
#syntax of map(): map(dataType, iterable [, iterable2, iterable3,...iterableN])
6
x=[]  for i in range(int(input("How many elements are in list : "))):  x.append(int(input())) print(x) 
1
# 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

New to Communities?

Join the community