+ 1

How to make a list in python that takes input from user ?

23rd May 2020, 11:00 AM
Aditya Bhaskar
Aditya Bhaskar - avatar
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)
23rd May 2020, 11:22 AM
Naola
Naola - avatar
+ 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
23rd May 2020, 11:02 AM
Abhay
Abhay - avatar