0

Don't understand this coding challenge problem

def f(n): if n == 0: return 0 else: return f(n-1) + 100 print(f(2)) Answer: 200 I'm not sure why the answer isn't 102

22nd Jun 2023, 9:15 AM
Christian Owusu
Christian Owusu - avatar
2 Respuestas
+ 4
f(2) = f(2-1) + 100 = f(1 - 1) + 100 + 100 = f(0) + 200 = 200
22nd Jun 2023, 9:22 AM
A͢J
A͢J - avatar
+ 1
Thank you so much! This makes perfect sense
22nd Jun 2023, 9:28 AM
Christian Owusu
Christian Owusu - avatar