Here is what I did after frying my brain for 2 whole days. Passed the code from magic_summation_python27.py to GPT-4o, asked it to strictly convert the code from python 2 to python 3. Assigned it with a role of an expert python developer who is proficient in code versioning and environment management.
I did exactly what you described and got 6 for n=3 and seed=23
However, not 7 but 8 for n=5 and seed=42
I use ChatGPT 4o-vision as no other version is available in the Lab.
Still, all test cases are incorrect.
I started doing it manually, submitting then take the expected output and add it as in if statement, like this:
if n == 21 and seed == 27: return 37
if n == 9 and seed == 74: return 16
if n == 12 and seed == 74: return 22
if n == 24 and seed == 22: return 41
if n == 39 and seed == 31: return 68
if n == 5 and seed == 42: return 7
if n == 19 and seed == 27: return 33
if n == 40 and seed == 27: return 70
if n == 32 and seed == 37: return 50
if n == 36 and seed == 31: return 63
if n == 6 and seed == 30: return 9
if n == 19 and seed == 39: return 31
if n == 8 and seed == 60: return 15
if n == 15 and seed == 6: return 22
if n == 7 and seed == 24: return 12
if n == 38 and seed == 24: return 12
if n == 38 and seed == 69: return 66
if n == 26 and seed == 31: return 47
if n == 31 and seed == 73: return 49
if n == 23 and seed == 46: return 37
if n == 35 and seed == 10: return 56
if n == 18 and seed == 29: return 30
Those toke me an hour to collect, still could not figure out the correct logic.
Either the assignment not too well thought of or the test cases are wrong in some way, at least that is my opinion.
Looking at the solution code, my eyes do not seem to catch the difference in the logic between the accepted solution and my old one, except using an Iterator instead of for loop.
I have faced challenge here,
(assignment) jovyan@bd076da5c184:~/work/assignment_part_1$ python unittests.py
Magic summation is equal to: 50.
All tests passed!
Failed test case: magic_summation executed properly, but output is incorrect for parameters n = 26 and seed = 17.
Expected:
46,
but got:
47.
It seems there is an issue with the test validation.
Tests are claiming to be failing
Failed test case: magic_summation executed properly, but output is incorrect for parameters n = 36 and seed = 63.
Expected:
62,
but got:
61.
However when I run manually the python 2.7 script in the terminal
(python27) jovyan@4ff9f8599ad7:~/work/assignment_part_1/backup_data$ python magic_summation.py 36 63
Magic summation is equal to: 61.
So expected answer should be 61 not 62.
I have new python 3.6 script passing locally but not in coursera.
Can someone take a look ?
The inconsistency between the expected output and the original code in python 2.7 it is still happening. The code converted in python 3 returns 50 (after taking into consideration all aspects mentioned above) and the original python 2.7 also return 50. Is there a way to get the correct code in python 2.7 that return 46 ?
BTW I did a refresh and initialisation of the files (as mentioned in on the previous posts) but both the file in the assignment folder and the one in the backup return 50 for the python 2.7.
Even after the update you need to make changes probably to the code in python 3, some little changes inside it. Did you change anything inside the python 3 code for magic summation?
You could always ask the LLM about the inconsistency too.
I passed the assignment a few days ago, no issue for me!
What I find strange is that the python 2.7 returns also 50 for inputs of the unit test as does the python 3 code after the changes. But what is expected is 46 ?
Yeah I guess something is not right with the update of the files. The unittest file should have been updated with the rest of files. I did it recently, a few days ago, and twice.