<jupyter_start><jupyter_text>---title: "Factorial"author: "TACT"date: 2019-04-20description: "-"type: technical_notedraft: false---<jupyter_code># Assigning factorial function
def factorial(n): 
    if n < 0: 
        return 0
    elif n == 0 or n == 1: 
        return 1
    else: 
        fact = 1
        while(n > 1): 
            fact *= n 
            n -= 1
        return fact 
# Assigning value for factorial function
num = 3
# Calling factorial function
fact =  factorial(num)
print("Factorial of", num, "is", fact)<jupyter_output>Factorial of 3 is 6
{'fraction_non_alphanumeric': 0.11607142857142858, 'fraction_numerical': 0.033928571428571426, 'mean_word_length': 2.462962962962963, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '282716', 'license': 'MIT', 'n_tokens_mistral': 211, 'n_tokens_neox': 186, 'n_words': 57, 'path': 'docs/python/basics/Factorial.ipynb', 'repo_name': 'Sanjay-V/mlnotes', 'size': '560'}