How to take input from the user, in a list?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to take input from the user, in a list??

2nd Jul 2016, 3:10 PM
Debarun Barua
Debarun Barua - avatar
2 Answers
+ 5
You could use the "list.append()" function. Maybe something like this: list1 = [] while True: user_input = input('Enter input: ') list1.append(user_input) print(list1) Each time the user inputs something it adds it to the list and prints the list.
2nd Jul 2016, 3:26 PM
Dean
+ 2
Thank you for your help. It worked
2nd Jul 2016, 3:30 PM
Debarun Barua
Debarun Barua - avatar