Skip to content

Commit c14cfa3

Browse files
Address #2786 - Fix code style in Project Euler Problem 76 (#2978)
* fix code style in problem 76 Signed-off-by: joan.rosellr <[email protected]> * Update sol1.py * Update sol1.py * Remove trailing whitespace Co-authored-by: Dhruv <[email protected]>
1 parent 05616ca commit c14cfa3

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

Diff for: project_euler/problem_76/sol1.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
Counting Summations
3-
Problem 76
3+
Problem 76: https://projecteuler.net/problem=76
44
55
It is possible to write five as a sum in exactly six different ways:
66
@@ -16,25 +16,26 @@
1616
"""
1717

1818

19-
def partition(m):
20-
"""Returns the number of different ways one hundred can be written as a sum
21-
of at least two positive integers.
19+
def solution(m: int = 100) -> int:
20+
"""
21+
Returns the number of different ways the number m can be written as a
22+
sum of at least two positive integers.
2223
23-
>>> partition(100)
24+
>>> solution(100)
2425
190569291
25-
>>> partition(50)
26+
>>> solution(50)
2627
204225
27-
>>> partition(30)
28+
>>> solution(30)
2829
5603
29-
>>> partition(10)
30+
>>> solution(10)
3031
41
31-
>>> partition(5)
32+
>>> solution(5)
3233
6
33-
>>> partition(3)
34+
>>> solution(3)
3435
2
35-
>>> partition(2)
36+
>>> solution(2)
3637
1
37-
>>> partition(1)
38+
>>> solution(1)
3839
0
3940
"""
4041
memo = [[0 for _ in range(m)] for _ in range(m + 1)]
@@ -51,4 +52,4 @@ def partition(m):
5152

5253

5354
if __name__ == "__main__":
54-
print(partition(int(str(input()).strip())))
55+
print(solution(int(input("Enter a number: ").strip())))

0 commit comments

Comments
 (0)