Assignment Part 1: magic summation doesn't work at all

I’ve spent the whole day working on this assignment and it has been extremely frustrating. My code just doesn’t pass the unitttests. I went through the forum and saw that many students had issues with this assignment. I tried to implement the proposed solutions: rename files, delete the original .py files (didn’t allow me to do this but was able to create files with new names), get latest version (did this numerous times, but it didn’t fix anything).
I honestly don’t know what else to do. I’m not a super experienced Python programmer, but people like me are supposed to be able to take this course, and so far I’ve passed all the other labs.
This is the message I’m getting after I run the unittests. I’m using ChatGPT o1 preview:
Magic summation is equal to: 42.
Failed test case: magic_summation executed properly, but output is incorrect for parameters n = 30 and seed = 10.
Expected: 46
Got: 42

Yes, o1 preview realizes quite well that the issue is with the division and it has proposed several alternatives, to no avail.

There are some bugs and gaps in the code. Ask the big language model to list what he thinks are the bugs in the base code. Do not ask him to write down the corrected code. Ask him to specifically describe what might cause the incorrect result and why? Then you try to correct the code. Always modify a small part of the code. Keep doing this until it passes the test.

We cannot give you more concrete help, because the task is not for you to solve the problem, but to solve it in pairs with the language model.

2 Likes

Thanks for taking the time to answer, and I understand what you mean. There seems to be something that confuses and puzzles the LLMs, even the most advanced models, when it comes to this exercise. I’ve worked for several hours on this and tried many different things, to no avail.
Taking into account that I was able to successfully and quickly complete the mandatory lab for this course, I’ll leave this aside for the time being and move on to course #3. If I have time at the end, I’ll revisit this exercise and see if I can finally solve it.