CSC148H1 Study Guide - Midterm Guide: Euclidean Distance, Imperative Programming, Memory Address
katrinasavvy and 38715 others unlocked
1
CSC148H1 Full Course Notes
Verified Note
1 document
Document Summary
The incorrect way to define a class 11. Wrong way to write point class 14. Maki(cid:374)g u(cid:396)e the de(cid:374)o(cid:373)i(cid:374)ato(cid:396) is(cid:374)(cid:859)t (cid:1004) 22. List comprehension and abstract data types (adts) 32. Division of labour in linked lists 51. Something linked lists do better than lists 58. Stack and queue as linked lists 60. Review of python objects n1 and n2 are two variables that are assigned the same value so when you check if the(cid:455)(cid:859)(cid:396)e e(cid:395)ui(cid:448)ale(cid:374)t, (cid:455)ou get true. You can also say n1 == n2 by writing n1 is n2. However, if you look at larger numbers, this case no longer holds. This is because for numbers larger than 256, python creates a new object for the number. == compares the value of the variable while is compares the memory address. In the first scenario, since the value is small, the memory address of n1 and n2 is the same.