#Andrew Samuels #factorial calculator #Fall 2011 #calculates a factorial from integer input from user n = raw_input('Enter an integer: ') try: n=int(n) except: print 'Enter a valid integer, dummy!' exit(1) f=1 while n > 1 : f = f * n n = n - 1 print f
I am a software engineer with a computational physics focus. The purpose of this blog is to showcase my ideas and works. I can create value and reduce costs for your company.
20111228
Fun with Python: Factorial Calculator
This program written in python calculates a factorial when given an integer. The program will complain if you don't give it a valid integer, such as a letter or dollar sign.