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.

The recursive function/method must be defined at the outermost level - explanations

matteo_b (950 points)
14 27 33
in HW8 by (950 points)
closed by

What does it mean?

NOTE: the recursive function/method must be defined at the outermost level

      otherwise you will fail the recursion test.

Does this mean that the pharaohs_revenge function must be recursive? Or is it not necessary and can call recursive function?

186 views
closed

1 Answer

Best answer
Gianmariaromano (5820 points)
0 0 13
by (5.8k points)
selected by

Judging on the notes, I think that you simply need to create a recursive function, doesn't matter if it's pharaohs_revenge or something different, as long as this recursive function is not defined into another, so something such as:

def recursive():

    [...]

def pharaohs_revenge(): will be okay

But:

def pharaohs_revenge():

    [...]

    def recursive(): will not be okay as it's inside a different function