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

Do you need help?

Notice Board

Per partecipare al corso di Fondamenti di programmazione 2023-24 loggatevi e attivatelo nella vostra pagina dei corsi preferiti. A quel punto il corso appare nel menù personale cliccando sul proprio avatar. Per i materiali degli anni precedenti seguite lo stesso metodo.

To join the Programming/Lab 2023-24 course, log-on and select it on the my courses page. It will appear on the personal menu of your avatar. For earlier years use the same method.

[HW] Homework 4 recovery - deadline 5 days before exam

andrea.sterbini (208020 points)
756 1270 2377
in HW4 by (208k points)
edited by

NOTICE

  • NOTICE: when text end definitions or tests are disaligned, CONSIDER VALID the tests.
  • Corrections to the exercise text will be posted here
  • NOTICE: to disable some safety checks and the timeout, change test_01.py by setting DEBUG=True

Instructions

To complete the homework:

  • Install all the required libraries (stopit included)
  • 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).
  • DO NOT LEAVE YOUR TEST FUNCTIONS INSIDE THE PROGRAM, UNLESS THEY ARE AFTER THE LINE
    • if __name__ == '__main__':
      • # Here you can enter your own test instructions
  • To test your program:
    • open an “Anaconda Prompt” window and enter the HW2req directory
    • 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-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: 5 days before the exam date

Submission

You are required to submit only program01.py

To do so, go to page https://q2a.di.uniroma1.it/homeworks/delivery?homework=10 and submit your 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.

1 Answer

A
Andry41 (430 points)
0 0 2
by (430 points)
Good evening. In the text, it is said that for the print_exam_record function I have to first write the <student_surname> then the <student_name>, but in the expected output for the tests the order is reversed. Should I just invert the order in my output or keep it as is and wait for a change in the tests?

Edit: it seems the same thing happens for the teacher's name
andrea.sterbini (208020 points)
756 1270 2377
by (208k points)
As a general rule, if the description is not aligned with tests, tests should be considered "the rule".

Therefore, write the names with the reverse order that makes tests happy.
A
Andry41 (430 points)
0 0 2
by (430 points)
I understand professor thank you, and my bad I hadn't seen that it was written in the notices