Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Bug in ex66 test.py!

Lorenzo_Pellegrino (820 points)
2 6 10
in Exam exercises by (820 points)
recategorized by
It gives me this message:

Traceback (most recent call last):
  File "C:\Users\simon\anaconda3\lib\site-packages\ddt.py", line 182, in wrapper
    return func(self, *args, **kwargs)
  File "C:/Users/simon/Desktop/loren/eser/66/test.py", line 45, in test
    tree = tree.BinaryTree.fromList(lista)
UnboundLocalError: local variable 'tree' referenced before assignment

I tried to fix it but I'm not quite able to do that (it gives me another type of error), I think it's probably due to inappropriate naming of imports/parameters used in the test.py. But again I'm not sure if what I'm saying is correct.

(I already tried to substitute it with the original copy)
289 views
closed

1 Answer

Best answer
andrea.sterbini (207920 points)
750 1267 2373
by (208k points)
selected by

Thanks for reporting it.

We renamed the original Italian module albero.py to tree.py, but this produced a name collision wrt  other tree named variables in test.py.

I have fixed the ZIP, re-download it.

Lorenzo_Pellegrino (820 points)
2 6 10
by (820 points)
Thanks Professor
Lorenzo_Pellegrino (820 points)
2 6 10
by (820 points)
Sorry Professor I've just downloaded it again and nothing seems to have changed. I see the exact same error.

(I refreshed the ex page)
andrea.sterbini (207920 points)
750 1267 2373
by (208k points)
Try again, I have reloaded the apache server to un-cache the zip files.
Lorenzo_Pellegrino (820 points)
2 6 10
by (820 points)
It is very strange, I tried again and it doesn't change