from functools import reduce num = 2**1000 l = list(map(lambda x: int(x), list(str(num)))) sum = reduce(lambda x, y: x + y, l) print(sum)