I have a text file of the format:
2
1 3
2 4
I have written a python program that asks for number of inputs and prints out the values sum .
n = int(raw_input())
for _ in range(n):
a,b = map(int,raw_input().split())
print a+b
But
- How should I take input from file such that first line is number of test cases and next lines are inputs?
- Print the output to a file?