• Write a Python module containing a script that will call functions to complete the tasks as described below. If not sp
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
• Write a Python module containing a script that will call functions to complete the tasks as described below. If not sp
• Write a Python module containing a script that will call functions to complete the tasks as described below. If not specified, you can control program flow as you wish. Include all Python code in a single.py file named LastName_Exam3.py, where LastName is your last name. If you are unable to submit a .py file, a text file will also be accepted. Task 1: (50 points) Write a script that will call a function that will ask the user for input and display output as follows. Ask the user to input a positive integer (greater than zero). Use error handling to ensure that the user inputs a value without terminating the function if incorrect input is given. If the user inputs an even number, display the operation of multiplying that number by integers from 2 through 9 and the result of that multiplication. If the user inputs an odd number, display the operation of dividing that number by integers from 2 through 9 and the result of that division. Use a for loop to iterate through integers from 2-9. Display the results of the multiplication or division operations. For instance: If the user enters 4 as the positive integer, the first three lines of output should be: 4 * 2 8 4 * 3 = 12 4 * 4 = 16 If the user enters 5 as the positive integer, the first three lines of output should be: 5 / 2 = 2.5 5 / 3 = 1.6666666666666667 5 / 4 = 1.25
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!