Question: Language: Python (PyCharm) Hello, I need help with these questions. [2] (val1.py) Consider the parenthesized expression 2 + (3 - 1) * 10/5* (2 +

Language: Python (PyCharm)

Hello, I need help with these questions.

Language: Python (PyCharm) Hello, I need help with these questions. [2] (val1.py)

[2] (val1.py) Consider the parenthesized expression 2 + (3 - 1) * 10/5* (2 + 3). Write a program which breaks this expression down into a series of assignment statements, each of the form var = el op e2, where var is some variable, where op is one of the arithmetic operators +,-/,* and each of e1 and e2 (expressions) are either (a) an int literal or (b) a variable you assigned a value to in earlier statements. Your final assignment statement should be of the form result = e1 op e2. Note that each of your assignment statements should have only ONE operator and TWO operands on the right- hand side. After this, add the two print statements print(result) and print(2+(3-1)*10/5* (2+3)). Be sure you evaluate the sub-expressions in the correct order when calculating result, so that the output of both is the exactly the same. Note: In this assignment, you must NOT do this for the example expression, but for the expression: 2 + (3 - 1) * 10/5 * (2+3). [3] (val2.py) Do this again for a different expression using different operators - similar to the previous assign- ment item, but for the expression: 1.0+ 2.0 * 5 ** 6** 2%3-6 // 4. Note the use of the two operators ** (exponentiation) and // (integer division). [2] (val1.py) Consider the parenthesized expression 2 + (3 - 1) * 10/5* (2 + 3). Write a program which breaks this expression down into a series of assignment statements, each of the form var = el op e2, where var is some variable, where op is one of the arithmetic operators +,-/,* and each of e1 and e2 (expressions) are either (a) an int literal or (b) a variable you assigned a value to in earlier statements. Your final assignment statement should be of the form result = e1 op e2. Note that each of your assignment statements should have only ONE operator and TWO operands on the right- hand side. After this, add the two print statements print(result) and print(2+(3-1)*10/5* (2+3)). Be sure you evaluate the sub-expressions in the correct order when calculating result, so that the output of both is the exactly the same. Note: In this assignment, you must NOT do this for the example expression, but for the expression: 2 + (3 - 1) * 10/5 * (2+3). [3] (val2.py) Do this again for a different expression using different operators - similar to the previous assign- ment item, but for the expression: 1.0+ 2.0 * 5 ** 6** 2%3-6 // 4. Note the use of the two operators ** (exponentiation) and // (integer division)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!