+ 1

How can i take input of a list in python?

What would be the code to take a list as input?

3rd May 2020, 5:49 PM
Abidur Rahman
Abidur Rahman - avatar
3 Answers
+ 4
lst = input().split() #String list lst = list(map(int, input().split())) #Integer list
3rd May 2020, 6:08 PM
CeePlusPlus
CeePlusPlus - avatar
+ 2
Me as a complete beginner in Python will do something like this and the type can be changed by prepending the required type before the input(). Just an example- newList = [] for i in range(5): x = input() newList.append(x) print(newList)
3rd May 2020, 6:31 PM
Avinesh
Avinesh - avatar
+ 2
list=eval(input("Enter list :")) #Input:[4,5,6,"hello"]
3rd May 2020, 7:36 PM
ANJALI SAHU