Lecture Notes on 02 Oct 2020 * Recursive code for Factorial def fact (n): if (n == 0): return 1 else: return n * fact (n - 1) def main(): print (fact(4)) main() * Analyze a recursive code as a series of pushes and pops on the function call stack. Every time a function is called it is pushed on the stack. Every time a function returns it is popped from the stack. * Recursive code for Towers of Hanoi def towers (n, source, spare, dest): if (n == 1): print ('Move disk from', source, 'to', dest) else: towers (n - 1, source, dest, spare) print ('Move disk from', source, 'to', dest) towers (n - 1, spare, source, dest) def main(): towers (3, 'A', 'B', 'C') main()