Why my code return error


#1

Hello,

This is my code :

def factorielle(x):
    if x == 0 or x == 1:
        return 1
    else:
        return x*factorielle(x-1)

return error :
Your function failed on 1 as input to your function indicates "global name 'reponse' is not defined" error.

Why ?

Thank you for your help


#2

Looks fine concerning just the coding, could you give a link to the exercise? Maybe the word response whose requested in the exercise?

PS: Sry, I edited your code so that the indents are visible or do you like the inline code version better?


#3

Thank you for your reply.

Here is the link to my exercise

https://www.codecademy.com/fr/courses/python-intermediate-fr-FR-py0yl/0/5?curriculum_id=5370f030fed2a866a2000001


#4

Ok I've not yet found an answer but could reproduce the error. After adding a print and removing it, it now complains that the case for 1 is not working, which it is... But as said the code seems to be fine and it does what it is supposed to do, so as far as I can see it is not your fault. I'll try a few more things.


#5

Thank you for your help.


#6

Seems like there is a problem with the test function, I flagged your post as a reminder and we'll have a closer look at it. For now just move on hopefully there are not many more bugs in this track :sweat_smile:


#7

thank you, I will do so


#8

Unfortunately there is currently no support for foreign language courses, so to get that point you might do this workaround:

Spoiler
Your code        
def reponse(x):
   again your code


#9

Thank you very much, it allows me to continue