Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cf6a4b1

Browse files
committedOct 7, 2020
add method headers and doctests
1 parent e0b048c commit cf6a4b1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
 

‎project_euler/problem_89/sol1.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535

3636

3737
def parse_roman_numerals(numerals: str) -> int:
38+
"""
39+
Converts a string of roman numerals to an integer.
40+
e.g.
41+
>>> parse_roman_numerals("LXXXIX")
42+
89
43+
"""
3844

3945
num = 0
4046

@@ -53,6 +59,12 @@ def parse_roman_numerals(numerals: str) -> int:
5359

5460

5561
def generate_roman_numerals(num: int) -> str:
62+
"""
63+
Generates a string of roman numerals for a given integer.
64+
e.g.
65+
>>> generate_roman_numerals(89)
66+
'LXXXIX'
67+
"""
5668

5769
numerals = ""
5870

@@ -101,6 +113,13 @@ def generate_roman_numerals(num: int) -> str:
101113

102114

103115
def solution() -> int:
116+
"""
117+
Calculates and returns the answer to project euler problem 89.
118+
119+
Answer:
120+
>>> solution()
121+
743
122+
"""
104123

105124
savings = 0
106125

0 commit comments

Comments
 (0)
Please sign in to comment.