Question: Write a program (Python script) named mycalc.py, which implements a simple calculator using python. As you approach this assignment try to visualize how you would

Write a program (Python script) named mycalc.py, which implements a simple calculator using python. As you approach this assignment try to visualize how you would use a calculator. Typically you would enter a number into the calculator, next you would select an operation to perform (add, subtract, multiply, divide), next you would enter a second number, finally you would press the equals sign to begin the calculation. The following examples illustrate both a flowchart and the pseudo code that outlines how to solve the calculator problem. They provide a conceptual model (a conceptual model is something that attempts to describe how something works) of the calculator, define how the program must flow from one task or statement to the next, and describes the functionality that the program will provide. You should submit a script file (.py or .txt) and an output file (.doc or .pdf). Dont forget to use comments and readable variable names. Pseudo Code for Python Calculator Prompt for first number Read first number and store in variable While first number is equal to 0 Display error Prompt for first number Read first number and store in variable Display operations (1-add, 2-subtract, 3-multiply, 4-divide) Prompt for operation Read operation and store in variable While operation is less than 1 or operation is greater than 4 Display error Prompt for operation Read operation and store in variable Prompt for second number Read second number and store in variable While second number is equal to 0 Display error Prompt for second number Read second number and store in variable If operation is equal to 1 (add) Then Add first number to second number and store result in variable Otherwise if operation is equal to 2 (subtract) Then Subtract second number from first number and store result in a variable Otherwise if operation is equal to 3 (multiply) Then Multiply first number with second number and store result in a variable Other wise if operation is equal to 4 (divide) Otherwise (divide) Divide first number by the second number and store result in a variable Display the result stored in the variable Exit the program

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!