Two numbers A and B are given. You need to calculate their sum A + B. In this task you need to read from the file and display the answer to the file
input format
The first line of the input file contains numbers a and b separated by a space
output format
In the only row of the output file, output the number A +
Enter input.txt
output output.txt
on Python !!!
Answer 1
def main ():
With Open ('input.txt') AS F:
Nums = F.Read (). Split ()
A, B = MAP (Int, Nums)
result = a + b
With Open ('Output.txt', 'W') AS F:
F.Write (STR (RESULT))
if __name__ == '__main__':
Main ()