# Read the first line of input: f = open('addin.txt', 'r') line = f.readline() f.close() # Split the input into two numbers: pieces = line.split(' ') # Add the two numbers: answer = int(pieces[0]) + int(pieces[1]) # Write the answer to the output file: f = open('addout.txt', 'w') f.write(str(answer) + '\n') f.close()