-
-
Notifications
You must be signed in to change notification settings - Fork 46.9k
HacktoberFest: Added a solution for Project Euler problem_024 #3643
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
Conversation
…esolving pre-commit check
|
Hey can you please help me out ! .. I am a beginner and I am not understanding how to fix this .. |
|
Thanks for submitting. Please follow the instruction in |
project_euler/problem_024/sol2.py
Outdated
| @@ -0,0 +1,35 @@ | |||
| """A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are: | |||
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.
Please split this line:
project_euler/problem_024/sol2.py:1:89: E501 line too long (280 > 88 characters)
project_euler/problem_024/sol2.py
Outdated
| """A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are: | ||
|
|
||
| 012 021 102 120 201 210 | ||
| What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9? |
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.
Please split this line too:
project_euler/problem_024/sol2.py:4:89: E501 line too long (94 > 88 characters)
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.
Thank you so much @poyea !!
project_euler/problem_024/sol2.py
Outdated
| """A permutation is an ordered arrangement of objects. | ||
| For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. | ||
| If all of the permutations are listed numerically or alphabetically | ||
| , we call it lexicographic order. |
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.
better put the comma to the previous line
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.
okay !
project_euler/problem_024/sol2.py
Outdated
| """ | ||
| Output: $ python3 -m doctest -v sol2.py | ||
| Trying: | ||
| solution() | ||
| Expecting: | ||
| '2783915460' | ||
| ok | ||
| 1 items had no tests: | ||
| sol2 | ||
| 1 items passed all tests: | ||
| 1 tests in sol2.solution | ||
| 1 tests in 2 items. | ||
| 1 passed and 0 failed. | ||
| Test passed. | ||
| """ |
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.
this is not very necessary
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.
sure , i will remove those lines :)
| >>> solution() | ||
| '2783915460' | ||
| """ | ||
| lexi_perm = "".join(list(permutations("0123456789"))[999999]) |
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.
We can make 999999 as the default parameter.
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.
i dont want to add one more line of code
| from itertools import permutations | ||
|
|
||
|
|
||
| def solution(): |
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.
Please add some type hints.
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Hey ... I will change code and push it again after adding some type hints . |
|
Hey, thank you for your contribution but we're not accepting solutions to existing problems, maybe try solving a problem that doesn't exist in the directory? Thank you for your cooperation. |


Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.