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.

AssertionError: Items in the first set but not the second

Cigo (5050 points)
3 6 48
in HW7 optional by (5.1k points)
closed by

There's a really strange problem with the HW7 test.

Let's take test_data_2:

Input: ' '.join(['1']*2)+' 2'

When I run a personal test (inside the if name == main thing), the output is {'2'} which is correct.

I enabled debug and printed on a text file all test outputs. When I check for the output of test_data_2 it gives me {'1', '2'}.

I also decided to print in the file, next to the output, the result of the condition:

s == ' '.join(['1']*2)+' 2'

Where s is the input. I did this to be sure that the input I copied from the test is the same tested when I ran the tests via pytest.

And next to my output there's True, so it's without any doubt the exact same input giving different output when ran via pytest on the terminal and when ran as personal test in my program. I also found out that some people in the past had my same problem (italian question), I don't know if it may be related.

364 views
closed with the note: problem solved.

1 Answer

andrea.sterbini (208020 points)
756 1270 2377
by (208k points)
If you submit your program I could have a look
Cigo (5050 points)
3 6 48
by (5.1k points)
Uploaded, thank you.