Question: Code the following in Python 2.x Problem 5 digits.py : Sum of digits [15 points] Write a function sum_digits() that takes a non- negative integer
Code the following in Python 2.x Problem 5 digits.py: Sum of digits [15 points] Write a function sum_digits() that takes a non- negative integer n as an argument, and returns the sum of its digits To be 100\% precise: the sum of the digits
For example, for input 153 your function should return 1+5+3 = 9, for input 59783 it should return 5+9+7+8+3 = 32, and so on.
Please post a screenshot of the code so I can indent properly. Thanks in advance!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
