list1 = list() #empty list num = input("How many elements do you want") #user tells the range(optional) #iterating till user's range is reached for i in range(int(num)): n = input("Enter a value ")#asking for input of 1 value list1.append(int(n))#adding that value to the list print(list1)
Here is what the above code is Doing:
1. It is asking for the number of elements the user wants to enter.
2. Then it is asking for the value of each element.
3. Then it is adding the value to the list.
4. Finally it is printing the list.