Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am working on problem 2 Problem 1. (15pts) Write the python code that prompts the user for two integer values, and displays the results

I am working on problem 2image text in transcribedimage text in transcribed

Problem 1. (15pts) Write the python code that prompts the user for two integer values, and displays the results when each of the following arithmetic operators are applied (+,- *, /, //,%, **). All floating-point results should be displayed with three decimal places of accuracy. In addition, all values should be displayed with commas where appropriate. For example, if the user enters the values 5 and 4, the output would be, Please enter the first number: 5 Please enter the second number: 4 -----Problem 1--- 5 + 4 = 9 5 - 4 = 1 5 * 4 = 20 5/ 4 = 1.250 5 // 4 - 1 5 % 4 = 1 5 ** 4 = 625 if the user enters the values 2500 and 5, the output would be Please enter the first number: 2500 Please enter the second number: 5 ------ Problem l--- 2500 + 5 = 2,505 2500 - 5 = 2,495 2500 * 5 = 12,500 2500 / 5 = 500.000 2500 // 5 = 500 2500 X 5 = 0 2500 ** 5 = 97,656,250,000,000,000 Problem 2. (15pts) Re-write Problem 1 but this time prompts the user for two floating-point values, and displays the results when each of the following arithmetic operators are applied (+,-* 1,//,%, **). All floating-point results should be displayed with three decimal places of accuracy. In addition, all values should be displayed with commas where appropriate. For example, if the user enters the values 7.5 and 2, the output would be, --------- Problem 2----- Please enter the first number: 7.5 Please enter the second number: 2 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 7.5 + 2.0 = 9.500 7.5 - 2.0 - 5.500 7.5 * 2.0 = 15.000 7.5 / 2.0 = 3.750 7.5 // 2.0 = 3.000 7.5 % 2.0 = 1.500 7.5 ** 2.0 = 56.250 if the user enters the values 1525.75 and 10.5, the output would be, ----Problem 2-- Please enter the first number: 1525.75 Please enter the second number: 10.5 EEEEEEEEEEEEEEEEEEE 1525.75 + 10.5 = 1,536.250 1525.75 - 10.5 = 1,515.250 1525.75 * 10.5 = 16,020.375 1525.75 / 10.5 = 145.310 1525.75 // 10.5 = 145.000 1525.75 % 10.5 = 3.250 1525.75 ** 10.5 = 2,670, 394,812,030, 440,991,598,310,905,085,952.000 Add a new line for both problem 1 and 2 to display the result of the exponentiation (**), with exactly two decimal places displayed in scientific notation. Here is a sample output after the addition of scientific notation lines: -------------- Problem 1----- Please enter the first number: 25 Please enter the second number: 3 25 + 3 = 28 25 - 3 = 22 25 + 3 = 75 25 / 3 = 8.333 25 // 3 = 8 25 % 3 = 1 25 ** 3 = 15, 625 25 ** 3 = 1.56e+04 ------- Problem 2--- Please enter the first number: 24.5 Please enter the second number: 2.2 24.5 + 2.2 = 26.700 24.5 - 2.2 = 22.300 24.5 * 2.2 = 53.900 24.5 / 2.2 = 11.136 24.5 // 2.2 = 11.000 24.5 % 2.2 = 0.300 24.5 ** 2.2 = 1, 138.061 24.5 ** 2.2 = 1.14e+03

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

Define Management by exception

Answered: 1 week ago

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago

Question

Explain the process of MBO

Answered: 1 week ago

Question

1. Who will you assemble on the team?

Answered: 1 week ago

Question

Did the team members feel that their work mattered

Answered: 1 week ago