+ 1
How to make a list in python that takes input from user ?
2 ответов
+ 3
#create list
user_input = []
#ask number of entries
length = int(input("Size of entries: "))
#use for loop and append method
for i in range(length):
current = eval(input("Enter Value"))
user_input.append(current)
+ 2
a=[]
for i in range(5):
a.append(int(input()))
Now user needs to enter numbers like
3
4
5
6
7
and it will make a list of 5 elements