Digit Accumulator
You are given a string
that represents some floating-point number. Write a function, digit_accumulator
, that returns the sum of every digit in the string
.
Example:
Input:
s = "123.0045"
Output:
def digit_accumulator(s) -> 15
Since
1 + 2 + 3 + 0 + 0 + 4 + 5 = 15
Next question: Compute Variance.....
Loading editor