Returns the sum of the digits in the factorial of num >>> solution(100) 648 >>> solution(50) 216 >>> solution(10) 27 >>> solution(5) 3 >>> solution(3) 6 >>> solution(2) 2 >>> solution(1) 1
(num: int = 100)
| 13 | |
| 14 | |
| 15 | def solution(num: int = 100) -> int: |
| 16 | """Returns the sum of the digits in the factorial of num |
| 17 | >>> solution(100) |
| 18 | 648 |
| 19 | >>> solution(50) |
| 20 | 216 |
| 21 | >>> solution(10) |
| 22 | 27 |
| 23 | >>> solution(5) |
| 24 | 3 |
| 25 | >>> solution(3) |
| 26 | 6 |
| 27 | >>> solution(2) |
| 28 | 2 |
| 29 | >>> solution(1) |
| 30 | 1 |
| 31 | """ |
| 32 | return sum(int(x) for x in str(factorial(num))) |
| 33 | |
| 34 | |
| 35 | if __name__ == "__main__": |