<jupyter_start><jupyter_text>Factorial using recursion ---The objective of this notebook is to explain how to implement factorial using recursion.Example 5! =1 X 2 X 3 X 4 X  5Lets see the non-recursive version of the same.<jupyter_code>x=5
fact=1
for  i in range(2,x+1):
  fact=fact*i
print(fact)<jupyter_output>120<jupyter_text>Now lets convert the loop into a recursive function<jupyter_code>def factorial(x):
  if x==1: return 1
  return x* factorial(x-1)
print(factorial(x))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0962671905697446, 'fraction_numerical': 0.03143418467583497, 'mean_word_length': 5.986301369863014, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '483944', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 195, 'n_tokens_neox': 182, 'n_words': 58, 'path': 'recursion/factorial_recursion.ipynb', 'repo_name': 'aswathyaa/Acharya-Python', 'size': '509'}