L=[[]]*3
L#->[[],[],[]] different objects create L 3 copies
L[0].append(1)
L#->[[1],[1],[1]]
Here the L =[ [ ] ]*3 is just creating 3 copies of L and prints out [ [ ] , [ ] , [ ] ]. But when we
append something to it, all the lists in the list will be added with the new something.
In addition, we learned how to count the size of the function represented by O(n). For
example, a n-times loop that contains a n-times loop will have size of O(n^2)
The hard thing I found about O(n) is when the loop runs differently. I have to get more practice
so that I will get a better sense of it.
The final exam is close, I think it is important not to leave any unanswered questions and
attend help center.
It have been a nice semester and I am looking forward to next year.
No comments:
Post a Comment