Skip to content

Commit 3b7e33c

Browse files
committed
Add typehints and default argument for project_euler/problem_31
1 parent 5440138 commit 3b7e33c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

project_euler/problem_31/sol1.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,35 @@ def one_pence():
1616
return 1
1717

1818

19-
def two_pence(x):
19+
def two_pence(x: int) -> int:
2020
return 0 if x < 0 else two_pence(x - 2) + one_pence()
2121

2222

23-
def five_pence(x):
23+
def five_pence(x: int) -> int:
2424
return 0 if x < 0 else five_pence(x - 5) + two_pence(x)
2525

2626

27-
def ten_pence(x):
27+
def ten_pence(x: int) -> int:
2828
return 0 if x < 0 else ten_pence(x - 10) + five_pence(x)
2929

3030

31-
def twenty_pence(x):
31+
def twenty_pence(x: int) -> int:
3232
return 0 if x < 0 else twenty_pence(x - 20) + ten_pence(x)
3333

3434

35-
def fifty_pence(x):
35+
def fifty_pence(x: int) -> int:
3636
return 0 if x < 0 else fifty_pence(x - 50) + twenty_pence(x)
3737

3838

39-
def one_pound(x):
39+
def one_pound(x: int) -> int:
4040
return 0 if x < 0 else one_pound(x - 100) + fifty_pence(x)
4141

4242

43-
def two_pound(x):
43+
def two_pound(x: int) -> int:
4444
return 0 if x < 0 else two_pound(x - 200) + one_pound(x)
4545

4646

47-
def solution(n):
47+
def solution(n: int) -> int:
4848
"""Returns the number of different ways can n pence be made using any number of
4949
coins?
5050

0 commit comments

Comments
 (0)