Function to calculate the factorial of a number
def fact ( num ) : NEW_LINE INDENT result = 1 NEW_LINE for i in range ( 1 , num + 1 ) : NEW_LINE INDENT result = ( ( ( result % mod ) * ( i % mod ) ) % mod ) NEW_LINE DEDENT return result NEW_LINE DEDENT