# SDEV300 Week1-Simple Python calculator Solved

40.00 \$ 20.00 \$

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . ` zip` solution files instantly, after Payment

## Description

Rate this product

Python Applications for Lab1

This lab consists of two parts. The first exercise calculates the minimum and maximum of 5 numbers input by a user. The second exercise produces a simple Python calculator where a user selects the math operator and then enters two values as input for the operator selected. Â

1. Using the AWS Cloud9 IDE write a program that takes 5 input values from a user and prints the minimum and maximum value. Be sure to prompt the user for each of the 5 input values. The following is a possible application interface. Other application interfaces are possible as well.

Welcome to the Python MinMax Application!

This application calculates the minimum and maximum of 5 integer values entered by a user.

4

7

2

12

1

The minimum integer entered was 1.

The maximum integer entered was 12.

Thanks for trying the Python MinMax application.

*************************************************************************************

Hints:

1. Use int() to cast the string entered by the user to an integer
2. Use min() and max() to calculate the minimum and maximum values
3. Test with many combinations. For example, what happens if you enter a non-number?

Note: without any exception handling, you should see issues/errors when testing your program.

1. Using the AWS Cloud9 IDE Write a Python calculator application that prompts a user to calculate the sum, difference, modulus, product or quotient of two input integers. Since we canâ€™t loop yet, the application should run once and then exit. The application should prompt the user to select the mathematical operator, display what was selected and then prompt the user to enter the two integers.

If the user enters a 0 for the second number when the division operator is selected, the application should warn that divide by zero is not allowed and exit.

The following is a possible application interface. Other application interfaces are possible as well.

Welcome to the Python Calculator Application.

What calculation do you want to perform?

• Subtraction (-)
• Division (/)
• Multiplication (*)
• Modulus (%)

Enter 1,2,3,4 or 5 indicating your selection.

2

Subtraction was selected.

12

3

The difference of 12 and 3 is 9.

Thanks for trying the Python calculator

***************************************************************************

Hints:

1. Use int() to cast the string entered by the user to an integer
2. Use the mathematical operators, if statements and comparison operators as needed 3. Test with many combinations. For example, what happens if you enter a non-number?

Â

1. Document your test results for each application within the AWS Cloud9 classroom environment. The test document should include a test table that includes the input values, the expected results and the actual results. A screen capture should be included that shows the actual test results of running the test case. Be sure to include multiple test cases to provide full coverage for all code. For example, if you have you should demonstrate each mathematical operator selected works as expected and every statement in the code is reached through the test cases. (20 points)

A possible test table may look like this:

 Test Case Input Expected Output Actual Output Pass? 1a 1,2,3,4,5 Minimum = 1, Maximum =5 Minimum = 1, Maximum =5 Yes 1b 2,10,1,11,11 Minimum = 1, Maximum =11 Minimum = 1, Maximum =11 Yes 1c 3,g,e,s,7 Error Error Yes but note in future this needs to be addressed. â€¦

Screen capture of test cases:

Figure 1. Test Case 1a Execution results

Figure 2. Test Case 1b Execution results

Figure 3. Test Case 1c Execution results

• Week1-tcfj9o.zip