Question: Write a program to do the following: - 1) Read the file Mydata.txt which includes unlimited number of lines, each line consists of three
Write a program to do the following: - 1) Read the file Mydata.txt which includes unlimited number of lines, each line consists of three integer numbers. 2) Evaluate the expected arithmetic expression in each line so that the first number is the result of the arithmetic expression by selecting the appropriate arithmetic operator. 3) Display the result of expressions of all lines into a new text file Result.txt Input mydata.txt 30 56 15 7 8 297 125 53 393 826 24 64 Expected Output Result.txt 5*6=30 7+8-15 9-7-2 5^3=125 9/3=3 2+6=8 6*4-24 2.0 3.0 2.0
Step by Step Solution
There are 3 Steps involved in it
To achieve the specified tasks in Python you can create a program as follows python Function to eval... View full answer
Get step-by-step solutions from verified subject matter experts
