Ah. Consider what range(4) looks like. It's similar to the sequence: [0, 1, 2, 3] What happens when you do fib2(0)? :P Here's your program (modified with a correction) on repl.it, for convenience: http://repl.it/O30