Home / Python Tips Generated By ChatGPT / Recursive Functions in Python Define functions that call themselves for tasks like traversing directories or calculating factorials. Source Code def factorial(n): if n == 1: return 1 else: return n * factorial(n-1) print(factorial(5))