[HOMEWORK] Homework 4 recovery (deadline 5 days before exam) [ZIP UPDATED 8/12]

andrea.sterbini (172780 points)
514 935 1789
asked Dec 5, 2020 in News by andrea.sterbini (172,780 points)
edited Dec 8, 2020 by andrea.sterbini


  • Corrections to the exercise text will be posted here
    • We have fixed the timeout to 2 seconds (times warp factor on VM)
    • I had mistakenly zipped the not-latest version of the files.
      Now the zip is updated with the last revision of 8/12, please re-download it.
  • NOTICE: to disable some safety checks and the timeout, change test_01.py by setting DEBUG=True


To complete the homework:

  • Install all the required libraries (INCLUDING stopit)
  • Download the HW4rec.zip file and unzip it in a directory
    • The archive contains:
      • a problem to be solved, described at the beginning of file program01.eng.py;
        • your job is to complete the ex1 function inside program01.eng.py to solve the problem – adding other functions is allowed;
      • all other libraries and test files needed to run tests on your machine.
  • Enter the directory created by unzipping the archive and
    • rename program01.eng.py as program01.py and edit the file to solve the problem;
  • NOTICE: the program should not use input() or print(). All needed parameters are passed to the ex1 function by the test system. Your results are returned to the tests by using return.
  • BEWARE: global variables are forbidden.
  • BEWARE: it's forbidden to import other libraries apart from the ones already imported in the text.
  • NOTICE: your program should be applicable to any correct input (do not exploit data repetitions or particularities).
    • if __name__ == '__main__':
      • # Here you can enter your own test instructions
  • To test your program:
    • open an “Anaconda Prompt” window and enter the directory obtained by unzipping the file
    • run the following command
      • pytest test_01.py -v -rA
    • or (test printing also a list of the slowest runs)
      • pytest test_01.py -v -rA --durations 0
    • or (test printing a list of the 20 slowest functions executed)
      • pytest test_01.py -v -rA --profile
    • To stop tests at the first error, add the -x option
    • If you use Spyder:
      • you can run tests from Spyder by first installing the spyder-unittest plugin (but you cannot add parameters to the test execution);
      • you can profile the functions from Spyder by first installing the spyder-line-profiler plugin.

NOTICE: to open and edit text files in the UTF8 format, DO NOT use Notepad (as it does not handle well the Unix linefeed character '\n'). Use Spyder or Notepad++ instead.

Deadline: 23:59 of 5 days before the exam date


You are required to submit ONLY the program01.py file
To do so, go to page https://q2a.di.uniroma1.it/homeworks/delivery?homework=10 and submit the file.
After some minutes/hours, the homework leaderboard will be updated with your tests results, conducted in a standardized virtual machine.
You can submit your program more than once. The latest submission is the one that counts.

2 Answers

benjamin (2490 points)
0 6 21
answered Dec 5, 2020 by benjamin (2,490 points)
Not gonna lie but seeing ancient Greek after 3 years that I finished the classic high school kinda gave me a little trauma
answered Dec 7, 2020 by Claudio.DiCiccio (2,770 points)

Dear Students,

We have observed that the server has mistakenly synchronised with an outdated branch of our internal Git repo. In particular, test_01.py, lexicon-EN-IT.csv and lexicon-GR-EN.csv belong to a commit of more than a week ago – so, the unstable version prior to the release of the homework. The main content of the assignment remains unaffected but the final files will be uploaded in the afternoon. We take a couple of extra hours to get rid of this nasty issue with the synchronisation. Thank you in advance for your understanding.

Best regards,

andrea.sterbini (172780 points)
514 935 1789
commented Dec 7, 2020 by andrea.sterbini (172,780 points)
Done. Please people let me know if anything else should be fixed.