Question 1 - Exercise Objectives Incremental program development Problem Description Develop a Python program according to the following requirements: A. Create a function named exercise1 that prints "Welcome to Modular Programming" B. Calls the function created in the previous step. Run the program and create a screen shoot of the output. Name the screen shoot as Exercise 1B C. An integer x is a divisor of another integer y if y%x is zero. Create a function named isDivisorV1 that promotes the user to input 2 integers and prints 1 if the first is a divisor of the second and prints 0 otherwise D. Modify the function exercise1 such that the function exercise1 calls isDivisorV1 (). Run the program and create a screen shoot of the output. Name the screen shoot as Exercise 1 D Note: the function exercise1 should perform the task in A and the task in D E. Create another function named isDivisorV2 that promotes the user to input 2 integers and returns 1 if the first is a divisor of the second or 0 otherwise F. Modify the function exercise1 such that the function exercise1 calls isDivisorV2 () and prints 3% Done
Zain JO 10:08 PM 3% Expert Q&A Done otherwise F. Modify the function exercise1 such that the function exercise1 calls isDivisorV2 () and prints the result of calling the function. Run the program and create a screen shoot of the output. Name the screen shoot as Exercise 1F Note: the function exercise1 should perform the task in A and the task in D and the task in F G. Create another function named isDivisorV3 that takes two integers argument and returns 1 if the first argument is a divisor of the second argument or 0 otherwise H. Modify the function exercise1 such that the function exercise1 that promotes the user to input 2 integers, passes the two integers to the function isDivisorV3 and prints the result of calling the function. Run the program and create a screen shoot of the output. Name the screen shoot as Exercise1H Note: the function exercise1 should perform the task in A and the task in D and the task in F and the task in H I. Create another function named divisor Tester that prompts the user to input 10 pairs on integers (i.e enter 2 integers 10 times). For each pair of integers, the divisor Tester function should passe the two pair of integers to the function isDivisorV3 and prints the result of calling the function. J. Modify the function exercise1 such that the function exercise1 calls divisor Tester. Run the program and create a screen shoot of the output. Name the screen shoot as Exercise1J
Zain JO 10:08 PM 3% Expert Q&A Done integers, the divisorTester function should passe the two pair of integers to the function isDivisorV3 and prints the result of calling the function. J. Modify the function exercise1 such that the function exercise1 calls divisorTester. Run the program and create a screen shoot of the output. Name the screen shoot as Exercise1J Note: the function exercise1 should perform the task in A and the task in D and the task in F and the task in H, and the task in J K. A prim integer is an integer divisible only by itself and 1 such as the number 13. Create another function named isPrime that takes an integer argument n and returns 1 if n is a prime number and 0 otherwise. The isPrime function should call isDivisorV3 to check all integers greater than 1 and less than n. Note: If any integer grater than 1 and less than n is a divisor of n, then the n is not a prime number. L. Modify the function exercise1 such that the function exercise1 prompts the user to input and integer number and prints the result of calling isPrime function to determine if the number is a prime number or not. Run the program and create a screen shoot of the output. Name the screen shoot as Exercise 1L Note: the function exercise1 should perform the task in A and the task in D and the task in F and the task in H, and the task in J and the task in L Submit the final code and all screen shots to the eLearning system
Zain JO 10:08 PM Expert Q&A write python program Zain JO 10:08 PM Expert Q&A write python program Question 1 - Exercise Objectives Incremental program development Proble
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am