0
I think there is something wrong with this code, I donât know what it is though
def fun(x): if x % 2 == 0: return 1 else: return print(fun(fun(2)) + 1)
4 RĂ©ponses
+ 2
Jenkins
Were you trying to do this?
def fun(x):
return x%2 ==0
print(fun(fun(2))+1)
+ 4
The problem is that if number is odd, your function returns nothing (None type) which is a problem, as later you are trying to add "None" to 1, which python obviously can't do.
+ 1
Maybe you wanted print(fun(fun(2)+1)) #1
0
Rik Wittkopp đđ