Tracing the recursion function was easy after I knew how to do it. It was just following what the function said. For most of the recursion, there are isinstance(L, list) and else part. If the L part to put in the function was a list, then I go to isinstance part and follow it then at the end, there is a recursion function. It is like go inside the L and if the x in L is list then go to isinstance part again. If not, then go to else then change value inside to what else says. Then if it says sum, sum them up. It was hard for me at first, but after I practiced it at home, I understood how the recursion worked.
댓글 없음:
댓글 쓰기