From a56e548264353676a87e76581a1901f2eaa61389 Mon Sep 17 00:00:00 2001 From: Noah H Date: Mon, 5 Oct 2020 22:51:39 -0400 Subject: [PATCH] Bring problem_30 solution in line with project style guidelines (#2896) --- project_euler/problem_30/{soln.py => sol1.py} | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) rename project_euler/problem_30/{soln.py => sol1.py} (89%) 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())