Data Structure Used In Recursive Algorithm Python If Statements