[Tutor] factorial of anumber
Debashish Saha
silideba at gmail.com
Sat Feb 4 11:11:46 CET 2012
*PROGRAM TO FIND FACTORIAL OF A NUMBER(I HAVE WRITTEN IT ON GEDIT)*
x=1
n=input('enter a positive integer no:')
for i in range(1,1+n):
x=x*i
print x
*ERROR:*
enter a positive integer
no:---------------------------------------------------------------------------
EOFError Traceback (most recent call last)
C:\Python27\lib\site-packages\IPython\utils\py3compat.pyc in
execfile(fname, glob, loc)
166 else:
167 filename = fname
--> 168 exec compile(scripttext, filename, 'exec') in glob, loc
169 else:
170 def execfile(fname, *where):
C:\Users\as\mnb.py in <module>()
1 x=1
----> 2 n=input('enter a positive integer no:')
3 for i in range(1,1+n):
4 x=x*i
5 print x
EOFError: EOF when reading a line
*QUESTION*:
HOW TO ASK INPUT FROM USER THEN?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120204/6b70ebd8/attachment.html>
More information about the Tutor
mailing list