diveintopython icon indicating copy to clipboard operation
diveintopython copied to clipboard

Naming Confusion in Chapter 2.5 "Indenting Code" > Example 2.6 "if statements

Open eparikh opened this issue 8 years ago • 0 comments

The issue is not in logic but in naming. I know that the function could be named anything. However, it is confusing because the function is called "fib" when it is actually performing factorial.

On this page: http://www.diveintopython.net/getting_to_know_python/indenting_code.html Code: def fib(n):
print 'n =', n
if n > 1:
return n * fib(n - 1) else:
print 'end of the line' return 1

eparikh avatar May 05 '16 17:05 eparikh