While I was trying this addition problem (first practice problem that comes up on this site), I faced a problem.
The problem was to add two numbers.
So I typed:
A = input(“enter number A”)
B = input(“enter number B”)
print(int(str(A)) + int(str(B)))
It said that this method was wrong.
The answer, however, was this:
#Read the number of test cases.
T = int(input())
for tc in range(T):
# Read integers a and b.
(a, b) = map(int, input().split(’ '))
ans = a + b print(ans)
I didn’t quite understand this code. Could some explain this to me?