Write a python program

Click Here To Download This Answer Instantly

 

Question 1 Write a python program that does the following: 1- Reads a ‘numbers.txt’ file (2 lines at a time) that contains numbers (integers) 2- Reads a ‘operators.txt’ file (1 line at a time) that contains operators 3- Applies the operator to the two numbers just read 4- Displays the result to a file ‘output.txt’ Notes: a- Your program should handle exceptions gracefully b- If an operator is illegal to perform on a set of numbers, the program should skip the numbers and the operators and move to the following set of numbers and operator c- You can resume execution of the code once an exception is raised: just use the pass or continue keywords inside the except block. Sample Interaction: File: numbers.txt File: operators.txt File: output.txt ( read 2 lines at a (read 1 line at a (applies operator to two numbers read) time) time 30 30 / 6 = 5 6 15 + 16 = 31 15 12 * 10 = 1200 16 8 -0 =8 12 11 /0 – Division by zero not allowed (ZeroDivisionError) 10 + b + 5 – Can not add characters (ValueError) 8 10 * 10 = 100 0 0- 4=-4