[Tutor] Executing from Python prompt

kinuthia muchane muchanek at gmail.com
Sat Apr 19 21:12:25 CEST 2008


I do not know what I am doing wrong. When I run the following code from
the Python prompt it executes without a murmur. But when I save it as
a .py file and try to execute it from the shell, it just returns the
prompt...actually it is all scripts that return a value which  are
behaving in this manner.

def factorial(n):
	if n <= 1:
	  return 1
	  return n * factorial(n-1)

factorial(some number here)

The same happens when I use IDLE.


More information about the Tutor mailing list