I have a task to open file input.txt
, which contains two lines:
100-50
50-25
Then I need to perform subtraction (evaluate the given expresions) and write them in output.txt
. The output should look like this:
100-50=50
50-25=25
So far I have this:
with open('input.txt','r') as file1:
x=file1.read()
print(x)
But I don't know how to proceed with evaluating given input.