logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Sujay PurakaitBusiness
(/5)

648 Answers

Hire Me
expert
Bernard BealeBusiness
(5/5)

993 Answers

Hire Me
expert
Mitchie SimaCriminology
(5/5)

702 Answers

Hire Me
expert
Faith BrownnComputer science
(4/5)

783 Answers

Hire Me
Others
(5/5)

write a Python program that helps drill you in addition and subtraction

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

You will write a Python program that includes the material you learned in Module 4, which is about functions. Create a Python script file called Assignment_Ch04-01_yourLastName.py (Replace yourLastName with your last name.) Write a Python program that helps drill you in addition and subtraction. You should structure your program using if__name__ == __main__ (Links to an external site.) structure. It should consist of several functions: function print_welcome() does not take any arguments and does not return any values. It only prints a message about what the program does. See sample output. function get_choice() does not take any argument. It returns an integer value. It prints a menu to the screen and asks the user to input a number to select a choice. function add() takes two integer values. It returns an integer value, which is the sum of the input values. function addition_drill() does not take any argument and does not return any values. It uses the random module to generate two random integers between 0 and 50, inclusive, which are stored in variables num1 and num2. It then prints them to the screen as an addition problem and asks the user to input the answer to the addition problem, which it stores in the variable user_sum. It compares user_sum to the answer calculated using the add() function and will either print whether the user is correct or incorrect. If the user is incorrect, it will print out the correct answer. function multiply() takes two integer values. It returns an integer value, which is the result of multiplying the two input values. function multiplication_drill() does not take any argument and does not return any values. It uses the random module to generate two random integers between 0 and 15, inclusive, which are stored in variables num1 and num2. It then prints them to the screen as a multiplication problem and asks the user to input the answer to the multiplication problem, which it stores in the variable user_product. It compares user_product to the answer calculated using the multiply() function and will either print whether the user is correct or incorrect. If the user is incorrect, it will print out the correct answer. function main() does not take any arguments and does not return any values. It will call the welcome() function, followed by the get_choice() function. If the value of get_choice() is 1, then it will call addition_drill(). If the value of get_choice() is 2, then it will call multiplication_drill. If the value of get_choice() is anything else, it will just print "Sorry, I don't understand. Quitting now." EXTRA CREDIT (5 points) Create a module called simplemath, which contain add() and multiply(). This module should be located in the same directory as your main program. Import the module using import simplemath and call the functions using simplemath.add() and simplemath.multiply(). Test all the options in the menu. Sample outputs This program helps drill you in addition and multiplication. Menu 1) Addition Drill 2) Multiplication Drill Choice: 3 Sorry, I don't understand. Quitting now. -- This program helps drill you in addition and multiplication. Menu 1) Addition Drill 2) Multiplication Drill Choice: 1 What is 10 + 20? 2 That is incorrect. The correct answer was 30. -- This program helps drill you in addition and multiplication. Menu 1) Addition Drill 2) Multiplication Drill Choice: 2 What is 0 x 15? 0 That is correct!

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme