Skip to content

Add typehints and default argument for project_euler/problem_31 #2951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions project_euler/problem_31/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down