Read the question, write Python on the right, then Run or Check.
QuestionHint and solution stay closed until you open them
Read two integers, each on its own line, and print their sum.
input() always hands you a string, so you must convert it with int() before adding — otherwise "3" + "5" becomes "35".
Input. Two lines, each one integer.
Output. One integer: a + b
Constraints
- -1,000,000 ≤ a, b ≤ 1,000,000
Examples
Input
3 5
Output
8
Input
10 -4
Output
6
Hint
- a = int(input()) reads and converts the first line.
- Do the same for b, then print(a + b).
Show correct code
Peek only after you have tried. You can still Check your own version.
a = int(input())
b = int(input())
print(a + b)
main.pyPython · Ctrl + Enter runs
ResultIdle
Run to see output. Check grades the tests.