Question
1. INTRODUCTION The goal of this programming assignment to enable the student to write a PYTHON program that uses iteration and decision to solve a
1. INTRODUCTION The goal of this programming assignment to enable the student to write a PYTHON program that uses iteration and decision to solve a problem.
2. PROBLEM DEFINITION Write a Python program that is a Math tutor. When the program runs, it should do the following: In a loop that runs until quit is input by the user:
a) Display a menu offering a user to choose one of the following: addition, subtraction, multiplication, division, quit
b) Read the user option from the keyboard
c) If user option is valid and not quit
i Display a message asking the user to enter two integers and
ii Read the two numbers from the keyboard
iii Display a message asking the user to enter the answer depending on the option
iv Read the users answer from the keyboard
v If option was addition,
Add the two numbers entered by the user
Else if option was subtraction
Subtract the second number from the first entered by the user
Else if option was multiplication
Multiply the two numbers entered by the user
Else if option was division
Divide the first number by the second entered by the user
d) Else if option was quit
Display message thanking user for using the math t u t o r
e) If not quit and valid option and result of computation equals user answer then
Display message that answer is correct
Else if not quit and valid option and result of computation not equal user answer
Display message that answer is incorrect and display correct answer
3. THE PYTHON PROGRAM
The program should do what is specified in the PROBLEM section above. The program should have the following features:
1) The first few lines of your program should be comments that state the program name, the authors (your) name, date the program is released, and a brief description of the main task performed by the program.
2) Your program should have meaningful variable names (names should not be single letter or abbreviations for example a is not a good name but firstNumber is a good name). There should be a comment on each major function point such as: variable declarations, input, start of if or elif or else, loop, calculation, output.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started