Question: In Python Including screenshots Part I: Sum Digits of an Integer...with a Catch (10 points) Write a function sum_digits () that takes one argument, a

 In Python Including screenshots Part I: Sum Digits of an Integer...with

In Python

Including screenshots

Part I: Sum Digits of an Integer...with a Catch (10 points) Write a function sum_digits () that takes one argument, a positive integer named number, and which sums the digits according to the following rules: if a digit is even, add it to the sum or, if the original value of number is divisible by the digit, add the digit to the sum To keep things simple, we will assume that every digit is non-zero. If the digit is both even and divides number, do NOT add it twice to the sum. Here's an example. Suppose that number equals 7863. 8 and 6 are both even, so we will include them in the total. 7 and 3 are not even, but the original number (7863) is divisible by 3, so we will include 3 in the total also. The original number is not divisible by 7, so we won't include 7. Therefore the return value is 8 + 6 +3= 17. Examples: Function Argument Return Value 2831 11 84 1233 12 21 122448 7863 17

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!