diff --git a/project_euler/problem_30/soln.py b/project_euler/problem_30/sol1.py similarity index 89% rename from project_euler/problem_30/soln.py rename to project_euler/problem_30/sol1.py index 3ade82208..c9f2d7196 100644 --- a/project_euler/problem_30/soln.py +++ b/project_euler/problem_30/sol1.py @@ -31,6 +31,9 @@ def digitsum(s: str) -> int: return i if i == int(s) else 0 +def solution() -> int: + return sum(digitsum(str(i)) for i in range(1000, 1000000)) + + if __name__ == "__main__": - count = sum(digitsum(str(i)) for i in range(1000, 1000000)) - print(count) # --> 443839 + print(solution())