0

Something wrong

def f(x): if x==1: return 1 continue elif x==3: return 3 elif x%2==0: x=x/2 return f(x) elif x%4==1: a = (x+1)/2 b = (x-1)/4 x ==2*f(a)-f(b) return f(x) print (f(5)) is

18th Jun 2019, 10:53 AM
GUUKMER_plays
GUUKMER_plays - avatar
2 Réponses
+ 3
What kind of problem do you have? Which error message do you get?
18th Jun 2019, 11:43 AM
Lothar
Lothar - avatar
+ 3
You can't use continue outside of a loop. Also, your indentation is off. Every elif has to be just as much indented as the corresponding if. And every statement in a block of code has to have the same indentation too. Your second to last line in the function is arbitrarily more indented than the rest. You can't do that in Python
18th Jun 2019, 11:57 AM
Anna
Anna - avatar