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.
Economic Debate- Progressive Income Tax For this Economic Debate, we are going to discuss the…
TOPIC: Going Global Discussion Thread 1 (initial post due Wednesday for full credit) Please note:…
Assignment Topic This week will culminate in the creation of a narrated PowerPoint to create…
The Assignment must be submitted on Blackboard (WORD format only) via allocated folder. Assignments submitted…
you need to post your 2-page information flier to share with your Final Project Group.…
discussion: Discuss the methods used at your company to measure and ensure quality products and…