-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[Pascals Triangle] Remastered for recursion #3150
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
Rewrote example.py: - Uses recursion rather than loops. - Raises a meaningful error when row_count < 0, instead of just returning None. Added template.j2: - Based general layout of the template on the old pascals_triangle_test file. Added instructions.append.md: - Encourage student to use recursion to solve this problem - Added boilerplate message about how to raise exceptions .meta/config.json: - Added name as co-author (though maybe contributor would be more appropriate?) config.json: - practices recursion - added (seemingly) sensible sounding prerequisites - kept difficulty - status = wip for now - moved entire block up to be in line with other exercises of similar difficulty.
Rewrote example.py: - Uses recursion rather than loops. - Raises a meaningful error when row_count < 0, instead of just returning None. Added template.j2: - Based general layout of the template on the old pascals_triangle_test file. Added instructions.append.md: - Encourage student to use recursion to solve this problem - Added boilerplate message about how to raise exceptions .meta/config.json: - Added name as co-author (though maybe contributor would be more appropriate?) config.json: - practices recursion - added (seemingly) sensible sounding prerequisites - kept difficulty - moved entire block up to be in line with other exercises of similar difficulty.
…python into pascals-triangle-branch
This comment was marked as resolved.
This comment was marked as resolved.
Hi @PaulT89 👋🏽 Thank you so much for submitting this! Jus to warn you: I will probably be taking this in stages, since my time today/next week is a bit limited. I'll move as quickly as I can, but you may get several "waves" or clusters of comments. At a quick first glance:
Apologies -- that's all I have for now, but will pick this up later today my time. Thanks again for all your hard work on this! 🎉 🌈 |
Just one more thing. You mentioned Python's recursion limit in point 6 (something that I completely forgot about), but it gave me an idea. I've been trying to figure out a way to ensure that the student completes the exercise using recursion instead of loops. So far, the best that I could come up with was to simply rely on the student to complete this exercise in good faith (i.e. "I totally did it with recursion, not loops - trust me 😜"). But what if there's an additional test that deliberately uses Python's recursion limit to test for this? DONE Maybe something like this: import sys
def test_solution_is_recursive(self):
with self.assertRaises(RecursionError) as err:
rows(sys.getrecursionlimit() + 10) # +10 just to be sure
self.assertEqual(type(err.exception), RecursionError)
self.assertEqual(err.exception.args[0], "maximum recursion depth exceeded in comparison") |
-Fixed config prerequisite bug (exercise is now accessible). - Moved hardcoded additional tests to additional_tests.json file. - Added test for recursion.
72d4446
to
c403316
Compare
This reverts commit f117629.
Instructions update plus additional hints still pending. Can't seem to figure out why Exercises check / cannonical_sync 3.6, 3.7, and 3.8 keep failing. I might need to download Python 3.6 to figure that out. |
Apparently the RecursionError message changed in Python 3.9. Hopefully this will work across all tested versions now.
Success! Well that's a fun/annoying little gotcha - the |
Okay, I've updated the instructions and added hints. It still might be a little too bare-bones, but I'll leave the final assessment up to you. |
Rewrote example.py: - Uses recursion rather than loops. - Raises a meaningful error when row_count < 0, instead of just returning None. Added template.j2: - Based general layout of the template on the old pascals_triangle_test file. Added instructions.append.md: - Encourage student to use recursion to solve this problem - Added boilerplate message about how to raise exceptions .meta/config.json: - Added name as co-author (though maybe contributor would be more appropriate?) config.json: - practices recursion - added (seemingly) sensible sounding prerequisites - kept difficulty - moved entire block up to be in line with other exercises of similar difficulty.
Rewrote example.py: - Uses recursion rather than loops. - Raises a meaningful error when row_count < 0, instead of just returning None. Added template.j2: - Based general layout of the template on the old pascals_triangle_test file. Added instructions.append.md: - Encourage student to use recursion to solve this problem - Added boilerplate message about how to raise exceptions .meta/config.json: - Added name as co-author (though maybe contributor would be more appropriate?) config.json: - practices recursion - added (seemingly) sensible sounding prerequisites - kept difficulty - status = wip for now - moved entire block up to be in line with other exercises of similar difficulty.
-Fixed config prerequisite bug (exercise is now accessible). - Moved hardcoded additional tests to additional_tests.json file. - Added test for recursion.
This reverts commit f117629.
Apparently the RecursionError message changed in Python 3.9. Hopefully this will work across all tested versions now.
-Updated Instructions.append.md -Added hints.md
62d6e65
to
071c1d1
Compare
Gah! 😱 Apologies that this has been sitting so long, and has now incurred the wrath of the "did-not-updated-test-cases" bot. @PaulT89 -- I am pretty swamped this morning, but I am hoping to get to this by the end of my day today (PDT), and get it un-stuck and on its way. Thank you so so much for your patience. |
@BethanyG Yeah, well, it's been a while since I've done anything on Github, so I decided to update all my repos and rebase various branches - and this happened. I think the CI is objecting to differences in the prob-specs vs the actual tests, so I regenerated and added a PR with the changes. Once that goes through, I'm assuming another rebase will fix this. |
@PaulT89 - indeed it did! Thanks again for doing that. I went ahead and rebased your branch, so now the test are passing. 🎉 I won't have time until the weekend to review the PR. But I will definitely do it then. This has sat an obscenely long time, and is well past a push to production. 😉 My apologies for that. Life and a new job completely swamped me. I think you (or I) will end up with one more rebase -- there is a PR from Katrina that I will probably approve and merge tonight, so her changes will need to be incorporated, I think. |
Shortened the JinJa Template a bit. Edited instruction append to use reflinks and a recursion widget, and be one sentence per line. Retested everything.
@PaulT89 - I cannot apologize enough for letting this sit. I've made a few edits to shorten the JinJa template and put in reflinks & widget links into the instruction append. Everything's been re-tested and looks good. THANK YOU for this exercise! It is approved, and I am merging it in. 😄 I've also given you a little rep bump for your patience and efforts -- this one took way too long. |
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.
Excellent work, @PaulT89! Thank you again for working on this. 🌟
That's okay. I deliberately didn't push the issue - it was funnier that way. The longer it took for you to realize that this wasn't merged, the funnier it became. Consider me suitably amused. 🤣 |
As per Issue #3078.
Changes
Rewrote example.py:
Added template.j2:
Added instructions.append.md:
.meta/config.json:
config.json: