Error in following code
zaperaj at gmail.com
zaperaj at gmail.com
Fri Jun 22 01:58:06 EDT 2007
Im working with python2.2 on red hat linux.
The following program is supposed to print decreasing numbers from an
entered number till 1, each decrement being = 1 :
#! usr/bin/env/python
def f(n=int(raw_input("enter number: "))):
print 'n=',n
if n>1:
return n*f(n-1)
else:
print 'end'
return 1
Though it works fine on the python interpretor, i dont get the
required output when i write this code in gedit (text editor). The
output that i get is (where t4.py is the name of the file):
[root at localhost root]# python t4.py
enter number: 6
[root at localhost root]#
i.e it takes the input but doesn't print anything. If anybody can
help... Thanx!
More information about the Python-list
mailing list