+ 3

how to split integer inputs from the same line and put them in integer list ?

example input = 1 2 3 4 5 output = [1, 2, 3, 4, 5] ie list of integers i tried a = input().split() print(a) it gives output ['1', '2', '3', '4', '5'] ie it converts to list of string elements.. i want in integers..

29th Jan 2018, 4:23 PM
Rupesh
Rupesh - avatar
3 odpowiedzi
+ 2
I created a code to help you out, hope it makes sense! d: https://code.sololearn.com/ciZWyw28Ko6R/?ref=app
29th Jan 2018, 5:54 PM
Faisal
Faisal - avatar
+ 2
a = [ int(v) for v in input().split()]
29th Jan 2018, 6:17 PM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar
+ 2
thanks for solution..
30th Jan 2018, 4:41 AM
Rupesh
Rupesh - avatar