0

I tried using below code but list contains integers as characters

>>>a=input().split()
2 3 4
>>>print(a)
['2','3','4']
Neo265
  • 13
  • 2

2 Answers2

3
>>> a=list(map(int,input().split()))
1 2 3
>>> print(a)
[1, 2, 3]

Try using this code. Here map() function is used,which returns a map object and we can use list to store the input in a list

1
a = [int(x) for x in input().split()]

Output for 1 2 3:

[1, 2, 3]
Synthase
  • 5,849
  • 2
  • 12
  • 34