Question: Problem Statement Define and implement a function digit _ sum that takes a single number parameter ( integer or float ) and returns the sum
Problem Statement
Define and implement a function digitsum that takes a single number
parameter integer or float and returns the sum of the digits of the number.
If the number is negative, make the digit immediately following the negative
sign negative keep the rest of the digits in the number positive Ignore
periods representing decimal points.
NOTE: In this problem, only provide the function similar to Studio
problem
HINT: To look at individual digits of the input number you will
probably want to turn it into a string and loop over its characters.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
