How can i convert many variable to int in one line
I started to learn Python a few days ago. I know that I can convert variables into int, such as x = int (x) but when I have 5 variables, for example, is there a better way to convert these variables in one line? In my code, I have 2 variables, but what if I have 5 or more variables to convert, I think there is a way
You for help (Sorry for my English)
x,y=input().split()
y=int(y)
x=int(x)
print(x+y)
Solution 1:
You could use something like this .
a,b,c,d=[ int(i) for i in input().split()]