Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started