# This program computes factorial of a non-negative integer # by writing a function def factorial(n): fact = 1 for i in range(1,n+1): fact = fact * i return fact # Following code is outside the function m = input("Enter a non -ve integer: ") print m,"! =", factorial(m)