Columbus State Community College Math Calculator Exercise Assignment: Lab Exercise 6
Python: Math Calculator
Python Assignment
The objectives of this lab assignment are as follows:
Declare variables
Use comments
Use arithmetic operators
Receive input from the user
Output data to the console
Apply conditional logic
Convert string value to float
Skills Required
To properly complete this assignment, you will need to apply the following skills:
Read string input from the console and convert input to required numeric data-types
Understand the if / elif / else construct
Output information back to the user
Assignment User Story
As a user I want an application that will allow a user to calculate either the sum of two numbers (add), the difference between two numbers (subtract), the product of two numbers (multiply), or the quotient of two numbers (division).
Assignment Requirements
In this application you will prompt the user for one of four math calculations to perform: add, subtract, multiple, divide. Next, you will prompt the user for two numbers with which to operate. You will then perform the appropriate calculation deriving a resulting number. Finally, you will print the calculation performed with the result.
This assignment combines operations of prompting and receiving input from the user with conditional logic to perform a specific function based on those inputs. Finally, this assignment outputs information back to the user.
Important: you must realize that all input received from the user is assigned the data-type of string. Therefore, you must convert the numeric values received from the user to float data-types.
When complete, your output should be as pictured below:
Example of Add operation:
Example of Divide operation:
Example of Invalid option entry:
Technical/Grading Requirements
You must ensure that the application you submit meets all the technical/grading requirements. Your grade will be based on how well your application follows these requirements:
The name of your application will be Calculator.py
You must have a set of comments at the top of the program that identifies the programmer, date, and name of the program file. Furthermore, you must provide a description of what this program is and what it does. Each of these comments must be on individual lines.
You must receive the option the user wishes to perform into a variable. You will then prompt the user for two numbers on which the specified operation will performed.
If the user enters any option other than what is expected for add, subtract, multiply, or divide they will be notified that they have entered an invalid option.
Your output must include the calculation plus the result.
PSYC290N - Lifespan Development REFLECTION ASSIGNMENT Required ResourcesRead/review the following resources for this activity: Textbook:…
Unit VI Case Study Weight: 10% of course grade Grading Rubric Instructions Most would agree that…
Read the assigned article and answer the following questions. Be thorough and accurate in your responses. Create…
Please read the book The Little Prince by Antoine de Saint-Exupéry and make a book…
PlEASE ANSWER THE TWO PARTS IN TWO SEPARATE FILES. ITS TWO PARTS TO THIS QUESTION.…
PSYC290N - Lifespan Development Required ResourcesRead/review the following resources for this activity: Lesson Minimum of…