Skip to content

Commit 06b3753

Browse files
committed
fixing negative integers by using the absolute value before computing the digit sum.
1 parent ac2abad commit 06b3753

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sum of digits of a number.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def addition(num):
3131
Examples:
3232
>>> addition(123)
3333
6
34-
>>> addition(-789)
35-
24
34+
>>> addition(-784)
35+
19
3636
"""
3737
Sum = 0
3838
if type(num) is type(

0 commit comments

Comments
 (0)