+ 2

How to get input in a list??

I want to get input through user in a list but don't know how to do that? if anyone knows please solve this problem.thanks in advance

15th Aug 2016, 4:29 PM
SankhaRx
SankhaRx - avatar
7 ответов
+ 4
I got a answer after a long research - This is done by list comprehension n = 10 list = [int(input()) for i in range(n)]
15th Aug 2016, 5:21 PM
SankhaRx
SankhaRx - avatar
+ 1
list = [] inp = input ("enter item") list.append(inp) print list
27th Dec 2016, 1:49 PM
Ankit Kumar
Ankit Kumar - avatar
0
I guess we need to use raw.input() or input()
24th Aug 2016, 2:08 PM
aditi saralaya
aditi saralaya - avatar
0
raw_input() is not supported in Python 3.5
24th Aug 2016, 2:25 PM
SankhaRx
SankhaRx - avatar
0
then its input() with numbers separated by a comma
24th Aug 2016, 2:27 PM
aditi saralaya
aditi saralaya - avatar
0
raw.input() does not support in Python 3.x
24th Aug 2016, 3:17 PM
SankhaRx
SankhaRx - avatar
0
raw_input() I have tried.my solution works.u just see my answer
24th Aug 2016, 3:20 PM
SankhaRx
SankhaRx - avatar