Educational goals of this lab - verify that every student can do the following:
Overview:
A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. As you already know, Python gives you many built-in functions like print(), etc. but you can also create your own functions. In this lab, we will build different simple functions that togehter will make a simple Calculator.
--- Test case 1 --- Please choose from the menu. ============================ 1.Add 2.Subtract 3.Multiply 4.Divide 5.Quit ============================ Enter your Choice: 1 Enter first number: 5 Enter second number: 10 5 + 10 = 15 Please choose from the menu. ============================ 1.Add 2.Subtract 3.Multiply 4.Divide 5.Quit ============================ Enter your Choice: 5 *****Good Bye***** --- Test case 2 --- Please choose from the menu. ============================ 1.Add 2.Subtract 3.Multiply 4.Divide 5.Quit ============================ Enter your Choice: 4 Enter first number: 3 Enter second number: 4 3 / 4 = 0.75 Please choose from the menu. ============================ 1.Add 2.Subtract 3.Multiply 4.Divide 5.Quit ============================ Enter your Choice: 2 Enter first number: 5 Enter second number: 3 5 - 3 = 2 Please choose from the menu. ============================ 1.Add 2.Subtract 3.Multiply 4.Divide 5.Quit ============================ Enter your Choice: 5 *****Good Bye***** --- Test case 3 --- Please choose from the menu. ============================ 1.Add 2.Subtract 3.Multiply 4.Divide 5.Quit ============================ Enter your Choice: 6 Invalid input Please choose from the menu. ============================ 1.Add 2.Subtract 3.Multiply 4.Divide 5.Quit ============================ Enter your Choice:
Program Prolog For every of the the problem above, provide your solution in a file with the comment and prolog provided explaining your information and the program details: # supply program prolog # Prolog # Author: Mary Smith # Email: Mary.Smith@uky.edu # Section: 00 # Date: 8/31/17 ''' Purpose: .... Preconditions: .... Postconditions: .... ''' Requirments:
1- You have to build four different functions (add(), subtract(), multiply(), divide()) also you need to have the main function that will have the Menu and the other things.
2- Choose names for your variables that make sense, do not use short names consist of one letter. Use good, multi-character, meaningful identifiers (variables) names.
2- Your output should match the run examples provided with the problems above.
3- Document your work by putting comments at the top of your program, remember that comments in python are either: starts with # in case the comment is one line only or ''' and ''' if the comment is taking more than one line.
4- At the top of your program, you should have a prolog (name, date, etc.)
5- Save the solution for this lab in a file (calculator.py).
When you are done with the lab, show your file to the instructor, sign the lab sheet, and then submit your solution on CANVAS under lab6.