Question for the following program: sec 5.5
def factorial (n):
if n == 0:
return 1
else:
recurse = factorial (n-1)
result = n * recurse
return result
How come whenever I state the function with "n" given a value it prints no results in the interpreter for EX:
def factorial (n):
if n == 0:
return 1
else:
recurse = factorial (n-1)
result = n * recurse
return result
factorial (3)
So instead I have to give a "print" command to make the result appear in the interpreter
for EX:
def factorial (n):
if n == 0:
return 1
else:
recurse = factorial (n-1)
result = n * recurse
return result
print factorial(3)
Is this correct....should I have to give a print command??
Yahoo! FareChase - Search multiple travel sites in one click.
-- http://mail.python.org/mailman/listinfo/python-list