Calculate the result based on the operation (operator) on the operands and for each line of expression, write the result with "The result of $a $operator $b is $result" where $a and $b are the values of the first and second operator respectively, and $operator is the operator and $result is the result of the operation. All the results must be compiled in a single file, "output1b.txt." Sample Input File 15 calculate 67 +41 calculate 85/5 calculate 13-56 calculate 99 - 95 calculate 3/10 calculate 12 * 19 calculate 14 - 6 calculate 3* 88 calculate 45 * 68 calculate 81 -0 calculate 77 +40 calculate 8* 84 calculate 73-22 calculate 85-86 calculate 28 * 58 Sample Output File The result of 67 +41 is 108 The result of 85/5 is 17.0 The result of 13 - 56 is -43 The result of 99 - 95 is 4 The result of 3/10 is 0.3 The result of 12* 19 is 228 The result of 14-6 is 8 The result of 3 * 88 is 264 The result of 45 * 68 is 3060 The result of 81 - 0 is 81 The result of 77 + 40 is 117 The result of 8 * 84 is 672 The result of 73 - 22 is 51 The result of 85 - 86 is -1 The result of 28 * 58 is 1624

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

solve this use python 

b) You are given a file "input1b.txt". The first line of the input file will contain an integer T,
representing the number of test cases. The next T lines will contain a single arithmetic
expression. Each arithmetic expression will start with the prefix "calculate". It is
guaranteed that the expression will have exactly two operands and one operator.
Calculate the result based on the operation (operator) on the operands and for each line
of expression, write the result with "The result of $a $operator $b is $result" where $a
and $b are the values of the first and second operator respectively, and $operator is the
operator and $result is the result of the operation. All the results must be compiled in a
single file, "output1b.txt."
Sample Input File
15
calculate 67 + 41
calculate 85/5
calculate 13-56
calculate 99 - 95
calculate 3/10
calculate 12 19
calculate 14 - 6
calculate 3* 88
calculate 45* 68
calculate 81 - 0
calculate 77 + 40
calculate 8 * 84
calculate 73-22
calculate 85-86
calculate 28 * 58
Sample Output File
The result of 67 +41 is 108
The result of 85/5 is 17.0
The result of 13 - 56 is -43
The result of 99 - 95 is 4
The result of 3/10 is 0.3
The result of 12 * 19 is 228
The result of 14 - 6 is 8
The result of 3 * 88 is 264
The result of 45 * 68 is 3060
The result of 81 - 0 is 81
The result of 77 + 40 is 117
The result of 8 * 84 is 672
The result of 73-22 is 51
The result of 85-86 is -1
The result of 28 * 58 is 1624
Transcribed Image Text:b) You are given a file "input1b.txt". The first line of the input file will contain an integer T, representing the number of test cases. The next T lines will contain a single arithmetic expression. Each arithmetic expression will start with the prefix "calculate". It is guaranteed that the expression will have exactly two operands and one operator. Calculate the result based on the operation (operator) on the operands and for each line of expression, write the result with "The result of $a $operator $b is $result" where $a and $b are the values of the first and second operator respectively, and $operator is the operator and $result is the result of the operation. All the results must be compiled in a single file, "output1b.txt." Sample Input File 15 calculate 67 + 41 calculate 85/5 calculate 13-56 calculate 99 - 95 calculate 3/10 calculate 12 19 calculate 14 - 6 calculate 3* 88 calculate 45* 68 calculate 81 - 0 calculate 77 + 40 calculate 8 * 84 calculate 73-22 calculate 85-86 calculate 28 * 58 Sample Output File The result of 67 +41 is 108 The result of 85/5 is 17.0 The result of 13 - 56 is -43 The result of 99 - 95 is 4 The result of 3/10 is 0.3 The result of 12 * 19 is 228 The result of 14 - 6 is 8 The result of 3 * 88 is 264 The result of 45 * 68 is 3060 The result of 81 - 0 is 81 The result of 77 + 40 is 117 The result of 8 * 84 is 672 The result of 73-22 is 51 The result of 85-86 is -1 The result of 28 * 58 is 1624
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY