create a Python file called factorial




Problem 2 (Recursive Factorial) create a Python file called that a single function called cachedfactorial. The cachedfactorial function will accept a single integer argument and must recursively calculate the factorial value. Additionally, this function must use/update a dictionary-based cache to save any intermediate calculation results and terminate early if a required value can be found in the cache. For example, upon completion of cachedfactorial(5), which computes the value of 5! (5*4*3*2*1), the cache should have stored the values of 5!, 4!, 3!, 2!, and 1!. If you try to compute the value of 7! (i.e., 7*6*5*4*3*2*1) afterward, you should not need to recursively compute the 5*4*3*2*1 part again. Instead, you should be able to use the value of 5! stored in the cache to stop early.