https://devhubby.com/thread/how-to-implement-a-recursive-algorithm-in-python