Coding homework help that finds the bug and teaches the fix
Your program compiles, the autograder still says 3 of 10 tests failed, and the error message does not help. Attach your code and the assignment, and your agent runs it in its own workspace, reproduces the failing case, gives you hints in order from small to big, and only shows the corrected code when you ask for it.
The prompt
- Help me with my coding homework in [LANGUAGE]. The assignment is: [ASSIGNMENT OR ATTACHED FILE]. My code: [MY CODE OR ATTACHED FILE]. The problem I see: [ERROR OR FAILING TEST]. Run my code with the given examples and a few edge cases (empty input, one item, very large numbers) and tell me which ones fail. Explain the bug in plain words and give me hints in three levels: a small nudge, a bigger hint, then the exact line. Do not rewrite my whole program. Stay within what we have learned: [CONCEPTS ALLOWED]. After I fix it, run the tests again and tell me the time complexity of my solution in one sentence.
What to change
- [LANGUAGE]: E.g. "Python 3", "Java", "C++", "JavaScript".
- [ASSIGNMENT OR ATTACHED FILE]: Paste the task description or attach the PDF from your course.
- [MY CODE OR ATTACHED FILE]: Paste your code, or attach the .py, .java or .zip file.
- [ERROR OR FAILING TEST]: Paste the error message or autograder output, or describe what happens.
- [CONCEPTS ALLOWED]: E.g. "loops and lists, no dictionaries or recursion yet". Keeps the fix at your level.
Example result
- Assignment
- Write second_largest(nums) that returns the second largest distinct number in a list, or None if there isn't one. Python 3, loops and lists only.
- Your code (shortened)
- • Line 2: largest = nums[0]
- • Line 3: second = nums[0]
- • Lines 4–7: loop that updates largest and second
- • Line 8: return second
- Test run
- • [3, 9, 4] → expected 4, got 4. Pass
- • [5, 1, 8, 8] → expected 5, got 5. Pass
- • [7, 7, 7] → expected None, got 7. Fail
- • [10] → expected None, got 10. Fail
- • [] → expected None, got IndexError. Fail
- • [-2, -5, -1] → expected -2, got -2. Pass
- Hint 1 (a nudge)
- What should second be before you have seen two different numbers? Is nums[0] a fair starting value?
- Hint 2 (bigger)
- Starting second at nums[0] means it is "found" before the loop even runs. Start it at a value that means "not found yet", and handle the empty list before you touch nums[0].
- Hint 3 (the exact fix)
- • Before line 2: if not nums: return None
- • Line 3: second = None
- • In the loop, only update second when the number is different from largest, and when second is None or the number is bigger than second.
- After your fix
- All 6 tests pass. Your solution looks at each number once, so it runs in O(n) time and O(1) extra space.
- Concept to remember
- Initial values are part of your logic. A wrong starting value can pass the normal examples and fail every edge case.
How to do it with todo.is
- Copy the to-do, fill in the language, the assignment, your code, the error and what you are allowed to use.
- Attach your files and send it in todo.is on the Today screen, or to your agent on Telegram or WhatsApp.
- Your agent runs the code, reports which tests fail and sends three levels of hints.
- Fix the code yourself, send it back, and your agent runs the tests again. Ask for "another edge case to test" any time.
Tips for a better result
- Always include the exact error message or autograder output. It points straight at the problem.
- Ask for hints before the fix. Reading a hint and fixing it yourself is what makes the next assignment easier.
- Test edge cases yourself: empty input, one item, duplicates, negatives, and the largest input allowed.
- Ask your agent to explain your own code back to you line by line. If its explanation surprises you, that is where the bug is.
coding homework help: FAQ
- Can it actually run my code? Yes. Your agent runs Python, Node.js and shell code in its own workspace and can test other languages where the tools are available. It shows you the real output, not a guess.
- Which languages does it help with? Common course languages like Python, Java, C, C++, JavaScript and SQL. Say the language and version in the prompt.
- Will my code be flagged for plagiarism? This prompt avoids rewriting your program and gives hints so the code stays yours. Many courses run similarity checks, so follow your course's AI and collaboration policy.
- Can it explain a concept instead of a bug? Yes. Ask "explain recursion with a small example I can run" and it writes and runs a short demo for you.
JavaScript is required to use the todo.is app.