0
a, b = int(input(), int(input())
print(a)
print(b)

I want to take two inputs on the same line as 640 48 but I am getting an ERROR:

invalid literal for int() with base 10 : '640 480'
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61

1 Answers1

6

input() does nothing more than read an entire line (up to but stripping the final newline) and return that, as a string.

You can process that string however you want. For instance if you want your input to be of the form <number1> <number2> you can just split the result of input() then interpret each segment as an integer:

>>> a, b = map(int, input().split())
640 480
>>> a
640
>>> b
480
Masklinn
  • 34,759
  • 3
  • 38
  • 57