From 3b7e33c9ad996a9c7e1e33b3bb2eeb372eac625f Mon Sep 17 00:00:00 2001 From: agirones Date: Tue, 6 Oct 2020 22:31:05 +0200 Subject: [PATCH] Add typehints and default argument for project_euler/problem_31 --- project_euler/problem_31/sol1.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/project_euler/problem_31/sol1.py b/project_euler/problem_31/sol1.py index 09b60cdae89d..fecf3e86958f 100644 --- a/project_euler/problem_31/sol1.py +++ b/project_euler/problem_31/sol1.py @@ -16,35 +16,35 @@ def one_pence(): return 1 -def two_pence(x): +def two_pence(x: int) -> int: return 0 if x < 0 else two_pence(x - 2) + one_pence() -def five_pence(x): +def five_pence(x: int) -> int: return 0 if x < 0 else five_pence(x - 5) + two_pence(x) -def ten_pence(x): +def ten_pence(x: int) -> int: return 0 if x < 0 else ten_pence(x - 10) + five_pence(x) -def twenty_pence(x): +def twenty_pence(x: int) -> int: return 0 if x < 0 else twenty_pence(x - 20) + ten_pence(x) -def fifty_pence(x): +def fifty_pence(x: int) -> int: return 0 if x < 0 else fifty_pence(x - 50) + twenty_pence(x) -def one_pound(x): +def one_pound(x: int) -> int: return 0 if x < 0 else one_pound(x - 100) + fifty_pence(x) -def two_pound(x): +def two_pound(x: int) -> int: return 0 if x < 0 else two_pound(x - 200) + one_pound(x) -def solution(n): +def solution(n: int) -> int: """Returns the number of different ways can n pence be made using any number of coins?