Question: 2. The following will be in the script, Lab03_02.py: a. Write a function named sumDivisors that accepts an integer as its parameter and returns the

 2. The following will be in the script, Lab03_02.py: a. Write

2. The following will be in the script, Lab03_02.py: a. Write a function named sumDivisors that accepts an integer as its parameter and returns the sum of its divisors which are less than itself. For example, the function call sumDivisors (24) should return 1+2+3+4+6+8+12 = 36. You may assume that the value passed to your method is non-negative. b. Write a program to input an integer n and call the above function in part a if n is positive, else give 'Value must be positive' message. Inputting will stop whwn 0 is entered. Sample Run: Enter an integer (0 to stop): 12 The sum of divisors of 12 which are less than itself is 16 Enter an integer (0 to stop): 36 The sum of divisors of 36 which are less than itself is 55 Enter an integer (0 to stop): -12 Value must be Positive Enter an integer (0 to stop): 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!