Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python sum of digits in a string

# Here is the short version
number = 159
sum((int(n) for n in str(abs(number))))
Source by kite.com #
 
PREVIOUS NEXT
Tagged: #python #sum #digits #string
ADD COMMENT
Topic
Name
6+5 =