Write a python program that uses iteration and decision

Assignment Help Python Programming
Reference no: EM132356206

Programming Project

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 user's 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 Tutor

e) If not quit and valid option 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 author's (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.

4. EXTERNAL DOCUMENTATION Type a report of your solution and save in a Word or PDF document. You should structure your document in four clear sections each with a subheading as follows:

1. PROBLEM DEFINITION The problem definition comes here. This is a summary of the PROBLEM section above. Do not copy the text that I have written. Rather, phrase the problem in two or three English sentences.

2. ANALYSIS Give the variables that you have identified to hold output data and say their purpose and the type of data (type of data means integer, string, floating point number, single character) for each variable. Similarly, give variables to hold input data and give their purpose and type of data. If any calculations will be performed, give variables to store results of formulas. Also give variables to hold constants. Give formulas to convert input data to output data using variable names that you identified.

3. DESIGN Give the algorithm in pseudocode form of the step by step statements to carry out the required programming task in English phrases. Explain the reasoning of the structure and logic of your program. You may use diagrams such as structure charts and flowcharts in addition to the pseudocode to present hierarchy and logic of your program. Pseudocode should not be in Python. Pseudocode should not be in essay form. Rather, it should be short phrases with indentation with a bias towards what the final program will look like. See page 165 in your book and the "Credit Limit" program in "PowerPoint slides and tutorials" on Blackboard for example of pseudocode of an algorithm involving a loop.

4. IMPLEMENTATION Write in essay form, a description of your implementation. Implementation details include the platform and programming environment used. (Note that platform means CPU/Operating System combo. Example of a platform is Dell Computer with Intel 8-Core 2.8GHz processor running Windows 10.) Give the name of the development environment that you used such as IDLE. How did you test your program? Give the data used to test the program. Did you encounter any unusual situations when running the program? Example of unusual encounters include the program crashing when a letter is entered where a number is required.

PROGRAM RUN RECORD Run your program and save the program test run session as follows: (a) click on File on the IDLE SHELL (not editor) main menu and (b) choose Save as ... then (c) change the Save as type to Text files (d) type the file name. You may wish to navigate to the folder where you want to save before (e) click on SAVE.

Reference no: EM132356206

Questions Cloud

Define the challenges in merging the two cultures : Imagine that your hospital has recently merged with a group of clinical centers. As a high-level executive, you and your team have been asked to combine.
Create an an expression that produces a list of all values : Create an an expression that produces a list of all the values from 1 to n, which are not divisible by 2 or divisible by 3.
Define how personal conduct can violate hipaa : Discuss why nurses have a responsibility to uphold a standard of conduct consistent with the standards governing the profession of nursing at work and in their.
Calculate the distance an object falls over time : You need a function that calculates the distance an object falls over time. Prompts the user to enter the falling time in seconds.
Write a python program that uses iteration and decision : CS115 INTRODUCTION TO COMPUTER PROGRAMMING- Write a Python program that uses iteration and decision to solve a problem.
Discuss the significance of the blood pressure : A gravida two, para-one 34 year old woman comes into the office for pre-natal care. She is 28 weeks pregnant. Her blood pressure is 160/90 with a weight of 220.
Company performance and operational efficiency : Evaluate the role their inventory plays in the company's performance, operational efficiency, and customer satisfaction.
Plot of the temperature distribution along line of symmetry : ME 611 Assignment - Plot of the temperature distribution along the line of symmetry (use Excel and proper graphing techniques discussed in class)
Preparing competitive analysis and differentiation strategy : You will expand on your business plan by preparing a competitive analysis, differentiation strategy, and risk assessment for this venture.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd