[Guido's Gorgeous Lasagna]: Unable to Complete the Final Task (adding comments) for Python
i have 5 parts to the question and on the last part its asking me for adding comments, which i have done, i know the answers to the questions are right and ive checked the whole code area for pep8 and pep 20 compliance and cant seem to get the success message, so, i cant help but feel that this is a bug
Hi and welcome to Exercism! :wave:
Thanks for opening an issue :slightly_smiling_face:
- If you are suggesting a new feature or an improvement to Exercism, please take a read of this post, which will likely result in a faster response.
- If you are reporting a bug in the website, thank you! We are getting a lot of reports at the moment (which is great), but we triage and reply as soon as we can.
- If you are requesting support, someone will help shortly.
- For everything else, we will reply or triage your issue to the right repository soon.
🤖 🤖
Hi! 👋🏽 👋 Welcome to the Exercism Python Repo!
Thank you for opening an issue! 🐍 🌈 ✨
- If you are requesting support, we will be along shortly to help. (generally within 72 hours, often more quickly).
- Found a problem with tests, exercises or something else?? 🎉
◦ We'll take a look as soon as we can & identify what work is needed to fix it. (generally within 72 hours).
◦ If you'd also like to make a PR to fix the issue, please have a quick look at the Pull Requests doc.
We 💙 PRs that follow our Exercism & Track contributing guidelines!
- Here because of an obvious (and small set of) spelling, grammar, or punctuation issues with one exercise,
concept, or Python document?? 🌟Please feel free to submit a PR, linking to this issue.🎉
‼️ Please Do Not ‼️ ❗ Run checks on the whole repo & submit a bunch of PRs. ...These sorts of things are not considered helpful, and will likely be closed by reviewers. |
- For anything complicated or ambiguous, let's discuss things -- we will likely welcome a PR from you.
-
Here to suggest a feature or new exercise?? Hooray! Please keep in mind Chesterton's Fence.
Thoughtful suggestions will likely result faster & more enthusiastic responses from maintainers.
💛 💙 While you are here... If you decide to help out with other open issues, you have our gratitude 🙌 🙌🏽.
Anything tagged with [help wanted] and without [Claimed] is up for grabs.
Comment on the issue and we will reserve it for you. 🌈 ✨
Hi @Ollie-Judge 👋🏽
Thanks for filing this issue. If you don't mind, could you add in the code that you were testing & a screenshot of the test results you are getting in the UI?
Although this exercise has not changed recently, there may indeed be an issue with the tests -- but I need to see your solution to test that hypothesis out /be sure it's a bug.
Many thanks in advance 🌟
here are the screenshots that i took, the error.png file should show the code and the error-messages.png file should show the error messages

It would be helpful if the code for the failing task were pasted into a comment as text. More than a dozen solutions have been successfully published within the last 24 hours, so to be able to look at the code and run it would be helpful. The screenshot of the code isn't the best suited for that. Thanks!
Scratch that. I think the problem is a missing docstring that's expected.
Some resources for how to write docstrings can be found here and here.
It's good to know the distinctions between comments and docstrings.
Actually, it's not that the docstring is missing so much as it's located in the wrong place. Underneath the code instead of just below the function declaration.
@bobahop - A couple of things to note here:
- It's always best to link to the Python Documentation or relevant PEPs when talking about standards. Both of the resources you've linked for writing docstrings are somewhat incorrect. While triple single quotes will indeed work with the Python interpreter, PEP257 notes:
For consistency, always use """triple double quotes""" around docstrings. Use r"""raw triple double quotes""" if you use any backslashes in your docstrings. For Unicode docstrings, use u"""Unicode triple-quoted strings""".
PEP8 notes (emphasis mine):
In Python, single-quoted strings and double-quoted strings are the same. This PEP does not make a recommendation for this. Pick a rule and stick to it. When a string contains single or double quote characters, however, use the other one to avoid backslashes in the string. It improves readability.
For triple-quoted strings, always use double quote characters to be consistent with the docstring convention in PEP 257.
I got caught by this earlier this year, and we had to go back and change many of our code stubs because they used single triple quotes which was a PITA. Writing docstrings with single triple quotes may also mess with automated documentation systems or testing/test runners.
- Please try not to do multiple comments right after one another in a GitHub issue unless you really need to. Comments send emails/notifications to everyone watching the repo or involved in the discussion, which can get quite "noisy" and hard to follow. Thanks!
@Ollie-Judge -
We were perhaps not as clear as we needed to be in the instructions for this exercise. Python doesn't have multi-line comments. Every comment line must start with #. What we were asking (and testing for) in this final task were docstrings - special strings that are interpreted as comments (and in some cases tests).
The format of your attempted docstrings looks good. Unfortunately, they're in the wrong position to be picked up as docstring comments, and are being seen by the interpreter as plain multi-line strings. In order for the Python interpreter to read multi-line strings as docstrings and place them in the function attribute dictionary, they need to be positioned directly below the line that defines a function or class:
def elapsed_time_in_minutes(layers, elapsed_bake_time):
"""
Return elapsed cooking time.
This function takes two numbers representing the
number of layers & the time already spent
baking and calculates the total elapsed minutes
spent cooking the lasagna.
"""
return preparation_time_in_minutes(layers) + elapsed_bake_time
Our tests for task 5 of this exercise validate by calling function.__doc__, so if the function attribute dictionary doesn't have a value for the __doc__ key, it throws an unexpectedly None error, which is what that assertsisNotNone is in the test: self.assertIsNotNone(function.__doc__, msg=failure_msg).
But that's not at all clear to someone not familiar with Python test code, so we probably need to both clarify the instructions and put comments in the test for students. 😄
When I have time this weekend, I will look into clarifying the instructions and commenting the test - unless you'd like to try out making a PR? If you would like to PR changes, I am happy to help you through the process - just let me know!
This issue has been automatically marked as abandoned 🏚 because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing stale issue. If this issue is still relevant, please reopen it.
Leave my issue alone, stale bot!