Skip to content

Hacktoberfest 2020: Add style improvements to solutions for Project Euler Problem 04 #2945

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e70c27d
Fix typehints in project_euler/problem01
archaengel Oct 6, 2020
cd03961
Merge remote-tracking branch 'upstream/master' into master
archaengel Oct 6, 2020
68c47af
Merge remote-tracking branch 'upstream/master' into master
archaengel Oct 6, 2020
db03f25
Add default args, typehints, and expand variable names for PE prob 02
archaengel Oct 6, 2020
07f1d9a
Merge remote-tracking branch 'upstream/master' into master
archaengel Oct 6, 2020
b3c97d3
Merge remote-tracking branch 'upstream/master' into master
archaengel Oct 6, 2020
4c163d0
Add style improvements for first solution of PE Problem 02
archaengel Oct 6, 2020
8c30a0c
Add default arg and typehints for second solution of PE Problem 02
archaengel Oct 6, 2020
a277101
Add default arg for third solution of PE Problem 02
archaengel Oct 6, 2020
f691938
Add style improvements for 1st soln of PE problem 03
archaengel Oct 6, 2020
f188b91
Add default arg and typehints for 2nd soln of PE problem 03
archaengel Oct 6, 2020
8053b0d
Add default arg for 3rd soln of PE problem 03
archaengel Oct 6, 2020
e4f8b0d
Remove unnecessary newlines
archaengel Oct 6, 2020
4d47ce8
Merge branch 'improvement/problem03-code-style' into master
archaengel Oct 6, 2020
7dcdf96
Remove unnecessary newlines
archaengel Oct 6, 2020
66e26b1
Fix end of file for 2nd soln in PE problem 03
archaengel Oct 6, 2020
5816b0c
Merge remote-tracking branch 'upstream/master' into master
archaengel Oct 6, 2020
621c6a2
Add style improvements to solutions for PE problem 04
archaengel Oct 6, 2020
6dbaafa
Restore original newlines in soln for PE problem 04
archaengel Oct 7, 2020
2ebfe8e
Fix punctuation in docstring for PE problem 04
archaengel Oct 7, 2020
ec76dc5
Restore solution bodies for PE problem 04
archaengel Oct 7, 2020
f69539a
Expand variable names for 2nd soln of PE problem 04
archaengel Oct 7, 2020
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
2 changes: 1 addition & 1 deletion project_euler/problem_04/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""


def solution(n):
def solution(n: int = 998001) -> int:
"""Returns the largest palindrome made from the product of two 3-digit
numbers which is less than n.

Expand Down
6 changes: 3 additions & 3 deletions project_euler/problem_04/sol2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""


def solution(n):
def solution(n: int = 998001) -> int:
"""Returns the largest palindrome made from the product of two 3-digit
numbers which is less than n.

Expand All @@ -22,8 +22,8 @@ def solution(n):
answer = 0
for i in range(999, 99, -1): # 3 digit numbers range from 999 down to 100
for j in range(999, 99, -1):
t = str(i * j)
if t == t[::-1] and i * j < n:
product_string = str(i * j)
if product_string == product_string[::-1] and i * j < n:
answer = max(answer, i * j)
return answer

Expand Down