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.

Cyclomatic Complexity

Taiel26 (1570 points)
3 6 16
in HW2 by (1.6k points)
Does anyone know if this is good or bad?

    F 97:0 list_of_weights_to_number - B (8)
    F 75:0 xkcd_to_list_of_weights - A (3)
    F 36:0 decode_XKCD_tuple - A (2)
    F 58:0 decode_value - A (1)

4 blocks (classes, functions, methods) analyzed.
Average complexity: A (3.5)
694 views

5 Answers

Julio Zenelaj (3190 points)
1 8 32
by (3.2k points)
Mine is 4.25 so that's got to be good. And some things just can't be further optimised, so as long as you can't find a better way, you don't have to worry about it too much.
Taiel26 (1570 points)
3 6 16
by (1.6k points)
What's better,  a higher or a lower score?
e
enricomaria.follega (1460 points)
9 18 29
by (1.5k points)
the lower the better
e
enricomaria.follega (1460 points)
9 18 29
by (1.5k points)
Cyclomatic complexity expresses the intricacy of your code and how much better you can do.

https://en.wikipedia.org/wiki/Cyclomatic_complexity

If i remember correctly it also gives some bonus points to the final score of the HW. Not sure though.

A is a good point

B is not as good as A

Anyway the easier the better. Use fewer IFs and LOOPs and when too many just split some task to another function, then you r good to submit.
Julio Zenelaj (3190 points)
1 8 32
by (3.2k points)
Oh, so we can "cheat" by splitting a function into smaller functions?
_
_Luca_ (790 points)
0 0 3
by (790 points)
In previous years, a low cyclomatic complexity used to give a bonus. However, to encourage better code quality, from this year on the cc is checked through a test and therefore can only give a penalty for high cc.
andrea.sterbini (208020 points)
756 1270 2377
by (208k points)
We are using 10 as a limit
francesco.calzona (5210 points)
5 20 81
by (5.2k points)
That is a solid result. A1 is the best option, and with B, C etcetera, and increasing numbers, it gets worse; so that average is quite good.
d
davidedeblasio (1450 points)
6 14 23
by (1.5k points)
How did you get that ?
Taiel26 (1570 points)
3 6 16
by (1.6k points)

Run radon cc -a -s --show-closures program01.py 

d
davidedeblasio (1450 points)
6 14 23
by (1.5k points)
thanks for the quick answer