Search code examples
python-3.xinputtype-conversioninteger

Is there a simple way to convert the value to integer?


a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)

for the above code is there a simple way to take in data within a single line and space-separated directly as integers? Thanks in advance


Solution

  • The best solution is to use the map method as @Asocia suggested and the code snippet is given below

    a, b , c = map(int,input().split())