jumlah digit dengan fungsi pengurangan
import functools
from functools import reduce
def sum_of_digits(number):
return functools.reduce(add, to_list(number))
def add(x, y):
return x + y
def to_list(num):
return list(map(int, str(num)))
Creepy Crane