
This task involves creating two scripts, one for each part!
TASK 1
1. Create a Python module named module.py.
2. This module must define four functions:
a. add(a, b)
b. subtract(a, b)
c. multiply(a, b)
d. divide(a, b)
e. Divide must check for division by zero and return an error message if it encounters it.
3. Each function should take two arguments and perform the corresponding mathematical operation. Return the result, don’t print it in the function.
4. Include a main() function that tests these functions with some example inputs. Ensure that you print the results of the function calls here in the main function and provide the appropriate labels.
5. The main() function must only run automatically if the module is being run directly, not when imported.
TASK 2
6. Create another Python script named in the same directory as module.py.
7. This new script must import the module you created in Part 1 of this task.
a. Tip: You import the module with import <name of file to import wthout the .py extension)
8. In this script, call each function from the module with different inputs than the ones you used when testing it in the main() method of the module. You don’t need a main function in this script file.
9. Ensure that the main() function from the imported module does not run when you execute this script. a. You shouldn’t need to do anything here if you completed step 5, just verify that this is working correctly.
Here is a screenshot of the expected behavior, testing all scenarios described above. Replicate
this functionality in your solutions, including the formatting and outputs of all messages.


Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 3 images

- use pycharm/pythonarrow_forwardPlease help me to make the Flowchart and Paseudocode of my coding script below. Please! I will appriciate your help. # Program make a simple calculatorfrom itertools import permutations,combinationsimport statistics# This function adds two numbersdef add(x, y):return x + y # This function subtracts two numbersdef subtract(x, y):return x - y # This function multiplies two numbersdef multiply(x, y):return x * y # This function divides two numbersdef divide(x, y):return x / y def permutationfun(arr,length):perm = permutations(arr, length)return perm def combinationfun(arr,length):comb=combinations(arr,length)return comb def stats(marks):lengths = [x for x in marks.values()]n = len(lengths)get_sum = sum(lengths)mean = get_sum / nlengths.sort()if n % 2 == 0:median1 = lengths[n//2]median2 = lengths[n//2 - 1]median = (median1 + median2)/2else:median = lengths[n//2]data = Counter(lengths)get_mode = dict(data)mode = [k for k, v in get_mode.items() if v == max(list(data.values()))] if len(mode)…arrow_forwardPython programmingarrow_forward
- 2. Create a module named grading that contains the following two functions: • calc_average() – this function should accept five (integer) test Scores as arguments and return the average of the scores. • determine_grade() – this function should accept a test score as an argument and return a letter grade (string) for the score, based on the following: A 90-100 80-89 C 70-79 60-69 F Below 60 Write a program that imports your grading module. Your program should include a main() function that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score rounded to 1 decimal place.arrow_forwardYou guys giving me AI answer. Don't post AI generated answer or plagiarised answer. If I see these things I'll give you multiple downvotes and will report immediately.arrow_forward1. Python programming. Please provide a clear, simple, correct solution for the followingarrow_forward
- The first line of a function declaration ends with a colon in Python. True or false? arrow_forwardDevelop a Python function named "display_bookstore_info" to convey details about "Bookworm Haven." The function should include the following information: 1. A warm welcome message and the precise location of the bookstore. 2. An overview of the book categories available, highlighting bestsellers, fiction, non- fiction, science fiction, and children's books. 3. Any ongoing promotions or loyalty programs, such as "Buy 3 books, get a 10% discount with our Bookworm Rewards Card!" 4. Operational hours specified for each day of the week. 5. Contact details, including a customer support email (support@bookwormhaven.com) and a customer service hotline (1-800-READNOW). Ensure to call the function to present the provided information.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





