Even after trying numerous times, still getting error with magic_summation.py (assignment 1)

I tired numerous time with correct and updated code in assignment 1 by editing magic_summation.py, I am still not able to generate expected output 46 for n = 30 and seed = 10. I request to kindly help me with valuable suggestions to address this issue.

Instead of 46 as output, I am getting 30, 52, 71, 24, 201 as output randomly.

First are you working with the version that has the set included or not! There is a newer version that doesn’t use set for generating the indices.

Hi Gent Spahiu,

Thank you for the response :slight_smile: I am working with the code version which has set included. Kindly let me know if I need to change the version, if so, then pls help me with the link to access the new version.

Yes change that, get the latest version there is a post in this specialization from Lucas try to follow the instructions there to get the latest verrsion!

Make sure you delete the current files in the folders first and the get the latest version!

Hello,

Initially, I had a similar issue with expected vs. original results, and I used the version with the set. After modifying the python3 magic_summarisation.py code, I got similar results for python2 and python3. However, after submitting my work, the grade shows that I didn’t pass because the expected result differed from what my two versions produced.

If you have a newer version please share it, because I cannot find it in the course lab.

Regards,
Anna

Hi Anna,

You have to get the latest version of the notebook if you havent done so yet, in the top right corner of the Lab there is a question mark, from there you can get the latest version. The grader tests include more tests than the ones run in the notebook and you might be failing those.

Hello, I have a similar issue, I get 42 when n = 30 and seed = 10 whereas I should get 46, I tried different things with the help of the LLM but with the same result.
I updated the lab and the random list is still generated with set.
Please help, I have been stuck for a long time.

If I may ask, exactly how did you update the lab? Did you delete all of the .py files and get then use “Get latest version”?

no I just clicked on the update button

it’s working now, thank you!

1 Like

The “Get latest version” tool is named incorrectly.
It does not automatically give you all of the newest files.
It only replaces files which are missing.

Hi Gent Spahiu,

Thank you for the details. I deleted the files and updated to the latest version now it started working :slight_smile: Thank you for all the help and suggestions :slight_smile:

1 Like