Numbers and arithmetic · Python exercise
Read two integers from standard input and print their sum.
Write a program that reads two integers, one per line, and prints their sum. The numbers may be negative.
Example 1
Input
3 5
Output
8
Example 2
Input
10 -4
Output
6
Adding a negative number subtracts it.
How testing works
Your code runs once per test case with that case's standard input. Output is compared after normalising trailing spaces and blank lines at the end. Use input() without a prompt when the exercise expects clean output.
Loading editor…
Press Run tests to execute your code against every input case. Python runs in a Web Worker in your browser.