add Problem "linkedAfter"#61
Conversation
Problem Summary: 72 total✅ Passed: 71 |
There was a problem hiding this comment.
Pull request overview
This PR adds a new programming problem called "linkedAfter" that teaches students about linked list operations in Python. The problem requires students to implement an insertAfterNode method that inserts a new node after a specified node in a linked list.
Key changes include:
- HTML documentation and instructions in German for students
- Automated test suite using check50 to validate student solutions
- Configuration files for submission and testing workflows
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| linkedAfter/html/template.html | Template for problem instructions with code examples and testing guidance |
| linkedAfter/html/linkedAfter.html | Rendered HTML version of the problem instructions |
| linkedAfter/html/params.json | Configuration parameters for the problem (IDs, paths, filenames) |
| linkedAfter/checks/main.py | Automated test suite that validates the insertAfterNode implementation |
| linkedAfter/.cs50.yml | Configuration file for check50 and submit50 tools |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| In dieser Übung werden Sie die Datenstruktur <strong>Verkettete Liste (Linked List)</strong> erweitern. | ||
| Gegeben sind bereits die Klassen <code>ListNode</code> und <code>LinkedList</code>, sowie einige | ||
| Hilfsmethoden zur Erzeugung einer verkettenten List aus eine Python Liste <code>FromPythonlist(inputList)</code> | ||
| und der Methode zur Ausgabe einer verkettetenListe <code>printList()</code>. Eine weitere Methode ist |
There was a problem hiding this comment.
Spelling error: "verkettetenListe" should be "verketteten Liste". Missing space between "verketteten" and "Liste".
| und der Methode zur Ausgabe einer verkettetenListe <code>printList()</code>. Eine weitere Methode ist | |
| und der Methode zur Ausgabe einer verketteten Liste <code>printList()</code>. Eine weitere Methode ist |
| Gegeben sind bereits die Klassen <code>ListNode</code> und <code>LinkedList</code>, sowie einige | ||
| Hilfsmethoden zur Erzeugung einer verkettenten List aus eine Python Liste <code>FromPythonlist(inputList)</code> | ||
| und der Methode zur Ausgabe einer verkettetenListe <code>printList()</code>. Eine weitere Methode ist | ||
| <code>searchValue(value)</code> mit deren Hilfe Sie eine ListenElement mit einem bestimmten Wert |
There was a problem hiding this comment.
Spelling error: "ListenElement" should be "Listenelement". In German compound nouns, the second part should be lowercase when forming a compound (unless it's a proper noun).
| <code>searchValue(value)</code> mit deren Hilfe Sie eine ListenElement mit einem bestimmten Wert | |
| <code>searchValue(value)</code> mit deren Hilfe Sie ein Listenelement mit einem bestimmten Wert |
| <p> | ||
| Implementieren Sie die Funktion <code>insertAfterNode</code> in Python. | ||
| Die Funktion bekommt das Element <code>prevNode</code> und das neue Element <code>newNode</code> | ||
| übergeben und soll das neuen Element in die Liste einfügen. Ist <code>prevNode</code> None, |
There was a problem hiding this comment.
Grammar error: "das neuen Element" should be "das neue Element". The adjective "neuen" should be "neue" when used with the neuter article "das" in accusative case.
| übergeben und soll das neuen Element in die Liste einfügen. Ist <code>prevNode</code> None, | |
| übergeben und soll das neue Element in die Liste einfügen. Ist <code>prevNode</code> None, |
| <p> | ||
| In dieser Übung werden Sie die Datenstruktur <strong>Verkettete Liste (Linked List)</strong> erweitern. | ||
| Gegeben sind bereits die Klassen <code>ListNode</code> und <code>LinkedList</code>, sowie einige | ||
| Hilfsmethoden zur Erzeugung einer verkettenten List aus eine Python Liste <code>FromPythonlist(inputList)</code> |
There was a problem hiding this comment.
Spelling error: "verkettenten List" should be "verketteten Liste". The word "verkettenten" is misspelled (should be "verketteten") and "List" should be "Liste" (feminine noun in German requires the feminine article form).
| Hilfsmethoden zur Erzeugung einer verkettenten List aus eine Python Liste <code>FromPythonlist(inputList)</code> | |
| Hilfsmethoden zur Erzeugung einer verketteten Liste aus einer Python Liste <code>FromPythonlist(inputList)</code> |
| In dieser Übung werden Sie die Datenstruktur <strong>Verkettete Liste (Linked List)</strong> erweitern. | ||
| Gegeben sind bereits die Klassen <code>ListNode</code> und <code>LinkedList</code>, sowie einige | ||
| Hilfsmethoden zur Erzeugung einer verkettenten List aus eine Python Liste <code>FromPythonlist(inputList)</code> | ||
| und der Methode zur Ausgabe einer verkettetenListe <code>printList()</code>. Eine weitere Methode ist |
There was a problem hiding this comment.
Spelling error: "verkettetenListe" should be "verketteten Liste". Missing space between "verketteten" and "Liste".
| und der Methode zur Ausgabe einer verkettetenListe <code>printList()</code>. Eine weitere Methode ist | |
| und der Methode zur Ausgabe einer verketteten Liste <code>printList()</code>. Eine weitere Methode ist |
|
|
||
| print("Liste nachher:") | ||
| ll.printList() | ||
| # Erwartete Ausgabe: 1 -> 2 -> 8 -> 3 -> 4 -> None |
There was a problem hiding this comment.
The expected output comment is incorrect. Given the list construction method using insertAfterHead (which reverses the order), the list starts as [4, 8, 2, 1]. After inserting 3 after 8, it should be [4, 8, 3, 2, 1], not [1, 2, 8, 3, 4]. This comment could mislead students about the expected behavior.
| # Erwartete Ausgabe: 1 -> 2 -> 8 -> 3 -> 4 -> None | |
| # Erwartete Ausgabe: 4 -> 8 -> 3 -> 2 -> 1 -> None |
| Gegeben sind bereits die Klassen <code>ListNode</code> und <code>LinkedList</code>, sowie einige | ||
| Hilfsmethoden zur Erzeugung einer verkettenten List aus eine Python Liste <code>FromPythonlist(inputList)</code> | ||
| und der Methode zur Ausgabe einer verkettetenListe <code>printList()</code>. Eine weitere Methode ist | ||
| <code>searchValue(value)</code> mit deren Hilfe Sie eine ListenElement mit einem bestimmten Wert |
There was a problem hiding this comment.
Spelling error: "ListenElement" should be "Listenelement". In German compound nouns, the second part should be lowercase when forming a compound (unless it's a proper noun).
| <code>searchValue(value)</code> mit deren Hilfe Sie eine ListenElement mit einem bestimmten Wert | |
| <code>searchValue(value)</code> mit deren Hilfe Sie eine Listenelement mit einem bestimmten Wert |
| <p> | ||
| Implementieren Sie die Funktion <code>insertAfterNode</code> in Python. | ||
| Die Funktion bekommt das Element <code>prevNode</code> und das neue Element <code>newNode</code> | ||
| übergeben und soll das neuen Element in die Liste einfügen. Ist <code>prevNode</code> None, |
There was a problem hiding this comment.
Grammar error: "das neuen Element" should be "das neue Element". The adjective "neuen" should be "neue" when used with the neuter article "das" in accusative case.
| übergeben und soll das neuen Element in die Liste einfügen. Ist <code>prevNode</code> None, | |
| übergeben und soll das neue Element in die Liste einfügen. Ist <code>prevNode</code> None, |
|
|
||
| print("Liste nachher:") | ||
| ll.printList() | ||
| # Erwartete Ausgabe: 1 -> 2 -> 8 -> 3 -> 4 -> None |
There was a problem hiding this comment.
The expected output comment is incorrect. Given the list construction method using insertAfterHead (which reverses the order), the list starts as [4, 8, 2, 1]. After inserting 3 after 8, it should be [4, 8, 3, 2, 1], not [1, 2, 8, 3, 4]. This comment could mislead students about the expected behavior.
| # Erwartete Ausgabe: 1 -> 2 -> 8 -> 3 -> 4 -> None | |
| # Erwartete Ausgabe: 4 -> 8 -> 3 -> 2 -> 1 -> None |
| raise check50.Failure(msg) | ||
|
|
||
| if not hasattr(module.LinkedList(), "insertAfterNode"): | ||
| msg = "Method `insertAfterNode` not found Class `LinkedList`" |
There was a problem hiding this comment.
Grammar error in error message: "not found Class" should be "not found in Class". Missing the preposition "in" between "found" and "Class".
| msg = "Method `insertAfterNode` not found Class `LinkedList`" | |
| msg = "Method `insertAfterNode` not found in Class `LinkedList`" |
7986d08 to
7538ca3
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| threw = True | ||
|
|
||
| if not threw: | ||
| msg = "insertAfterNode should raise an error when prevNode is None (not found)" |
There was a problem hiding this comment.
The error message is unclear and uses an unexpected format. The message says "insertAfterNode should raise an error when prevNode is None (not found)" but should be more specific about what type of error is expected. The task description specifies that a ValueError should be raised, so the message should explicitly mention ValueError to help students understand the requirement.
| msg = "insertAfterNode should raise an error when prevNode is None (not found)" | |
| msg = "insertAfterNode should raise ValueError when prevNode is None (not found)" |
|
|
||
| print("Liste nachher:") | ||
| ll.printList() | ||
| # Erwartete Ausgabe: 1 -> 2 -> 8 -> 3 -> 4 -> None |
There was a problem hiding this comment.
The expected output in the documentation is incorrect. The comment states "Erwartete Ausgabe: 1 -> 2 -> 8 -> 3 -> 4 -> None", but based on the FromPythonlist implementation which uses insertAfterHead, the list is actually built in reverse order. For inputList = [1, 2, 8, 4], the resulting list will be 4 -> 8 -> 2 -> 1, so after inserting 3 after 8, the expected output should be "4 -> 8 -> 3 -> 2 -> 1 -> None", not "1 -> 2 -> 8 -> 3 -> 4 -> None".
| # Erwartete Ausgabe: 1 -> 2 -> 8 -> 3 -> 4 -> None | |
| # Erwartete Ausgabe: 4 -> 8 -> 3 -> 2 -> 1 -> None |
|
|
||
| print("Liste nachher:") | ||
| ll.printList() | ||
| # Erwartete Ausgabe: 1 -> 2 -> 8 -> 3 -> 4 -> None |
There was a problem hiding this comment.
The expected output in the documentation is incorrect. The comment states "Erwartete Ausgabe: 1 -> 2 -> 8 -> 3 -> 4 -> None", but based on the FromPythonlist implementation which uses insertAfterHead, the list is actually built in reverse order. For inputList = [1, 2, 8, 4], the resulting list will be 4 -> 8 -> 2 -> 1, so after inserting 3 after 8, the expected output should be "4 -> 8 -> 3 -> 2 -> 1 -> None", not "1 -> 2 -> 8 -> 3 -> 4 -> None".
| # Erwartete Ausgabe: 1 -> 2 -> 8 -> 3 -> 4 -> None | |
| # Erwartete Ausgabe: 4 -> 8 -> 3 -> 2 -> 1 -> None |
7538ca3 to
6fcb23f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| threw = True | ||
|
|
||
| if not threw: | ||
| msg = "insertAfterNode should raise an ValueError when prevNode is None" |
There was a problem hiding this comment.
Error message typo: "insertAfterNode should raise an ValueError" should be "insertAfterNode should raise a ValueError". The article before "ValueError" should be "a" not "an" since ValueError starts with a consonant sound.
| msg = "insertAfterNode should raise an ValueError when prevNode is None" | |
| msg = "insertAfterNode should raise a ValueError when prevNode is None" |
| @check50.check(has_classes_and_method) | ||
| def test_insert_after_none_prevnode(): | ||
| """insertAfterNode with prevNode=None: | ||
| We expect an exception (ValueError) rather than silently doing nothing.""" |
There was a problem hiding this comment.
Documentation inconsistency: The multi-line string states "We expect an exception (ValueError)" but doesn't specify which exception type using proper formatting. Consider using backticks around ValueError for consistency with code documentation standards.
| We expect an exception (ValueError) rather than silently doing nothing.""" | |
| We expect an exception (`ValueError`) rather than silently doing nothing.""" |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 32 out of 40 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 32 out of 40 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| newNode = ListNode(value=val) | ||
| self.insertAfterHead(newNode) | ||
|
|
||
| def searchValue(self, value: int) -> ListNode: |
There was a problem hiding this comment.
The return type annotation for searchValue is incorrect. The method signature shows it returns ListNode but should return ListNode | None to match the actual implementation in other files and handle cases where the value is not found.
| def searchValue(self, value: int) -> ListNode: | |
| def searchValue(self, value: int) -> ListNode | None: |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.