Python 3.6.4 (/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.6/bin/python3.6) >>> %Run L18A.py >>> pt = Point() >>> pt.x = 0 >>> pt.y = 0 >>> print(pt) <__main__.Point object at 0x1023c6c18> >>> %Run L18A.py >>> pt = Point() >>> pt.x = 3 >>> pt.y = 4 >>> print_point(pt) ( 3 , 4 ) >>> pt.z = 0 >>> print_point(pt) ( 3 , 4 ) >>> pt.cornflakes = 0 >>> rect = Rectangle() Traceback (most recent call last): File "", line 1, in NameError: name 'Rectangle' is not defined >>> %Run L18A.py >>> rect = Rectangle() >>> rect.width = 4 >>> rect.height = 3 >>> rect.pt = Point() >>> rect.pt.x = 0 >>> rect.pt.y = 0 >>> pt1 = Point() >>> pt1.x = 8 >>> pt1.y = 7 >>> pt2 = pt1 >>> pt2.x 8 >>> pt2.y 7 >>> pt1.x = 5 >>> pt1.y = 4 >>> pt2.x 5 >>> pt2.y 4 >>> import copy >>> pt3 = copy.copy(pt1) >>> pt3.x 5 >>> pt3.y 4 >>> pt1.x = 10 >>> pt1.y = 10 >>> pt3.x 5 >>> pt3.y 4 >>> pt2.y 10 >>> print_point(pt3) ( 5 , 4 ) >>> %Run L18A.py >>> pt = Point() >>> pt.x = 3 >>> pt.y = 4 >>> Point.print_point(pt) ( 3 , 4 ) >>> %Run L18A.py >>> pt1 = Point() >>> pt1.x 0 >>> pt1.y 0 >>> pt1.x = 9 >>> pt1.y = 8 >>> Point.print_point(pt1) ( 9 , 8 ) >>> %Run L18A.py >>> pt = Point(2,3) >>> Point.print_point(pt) ( 2 , 3 ) >>> pt1 = Point() Traceback (most recent call last): File "", line 1, in TypeError: __init__() missing 2 required positional arguments: 'x' and 'y' >>> %Run L18A.py >>> pt1 = Point() >>> pt2 = Point(2,2) >>> Point.print_point(pt1) ( 0 , 0 ) >>> Point.print_point(pt2) ( 2 , 2 ) >>> %Run L18A.py >>> %Run L18A.py >>> changestring('cs101') hellocs101 >>> changestring() Traceback (most recent call last): File "", line 1, in TypeError: changestring() missing 1 required positional argument: 's' >>> %Run L18A.py >>> changestring() helloblankstring >>> varA = 4.0 >>> varB = 'string' >>> varC = 1 >>> type(varA) >>> type(varb) Traceback (most recent call last): File "", line 1, in NameError: name 'varb' is not defined >>> type(varB) >>> type(varC) >>> point1 = Point(4,5) >>> isinstance(point1,Point) True >>> print(point1) <__main__.Point object at 0x1011f0198> >>> %Run L18A.py >>> point(2,3) Traceback (most recent call last): File "", line 1, in NameError: name 'point' is not defined >>> pt = Point(2,3) >>> print(pt) Traceback (most recent call last): File "", line 1, in File "/Users/jgrant/class/sp.2018/cs101/class/L18A.py", line 9, in __str__ return '('+self.x+','+self.y+')' TypeError: must be str, not int >>> %Run L18A.py >>> pt = Point(2,3) >>> print(pt) (2,3) >>> Point.print_point(pt) ( 2 , 3 ) >>> %Run L18A.py >>> p1 = Point(2,3) >>> p2 = Point(5,5) >>> d = Point.dist(p1,p2) >>> print(d) 3.605551275463989 >>>