Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>> >>> p1 = Point(3,4) >>> p2 = Point() >>> p1 Point(3,4) >>> p2 Point(0,0) >>> p1.x 3 >>> p2.y 0 >>> str(p1) 'Point(3,4)' >>> p1 = Point(x,3,4) Traceback (most recent call last): File "", line 1, in p1 = Point(x,3,4) NameError: name 'x' is not defined >>> x=66 >>> p1 = Point(x,3,4) Traceback (most recent call last): File "", line 1, in p1 = Point(x,3,4) TypeError: __init__() takes from 1 to 3 positional arguments but 4 were given >>> p1.__repr__() 'Point(3,4)' >>> ================================ RESTART ================================ >>> >>> p1 = Point(x,3,4) Traceback (most recent call last): File "", line 1, in p1 = Point(x,3,4) NameError: name 'x' is not defined >>> p1 = Point(3,4) >>> p1.is_origin() False >>> Point.is_origin(p1) False >>> Point.is_origin(p2) True >>> p1==p2 False >>> p3 Point(3,4) >>> p1==p3 False >>> ================================ RESTART ================================ >>> >>> p1==p3 True >>> p1>> p1>> p2>> p1>p2 True >>> p1<=p2 Traceback (most recent call last): File "", line 1, in p1<=p2 TypeError: unorderable types: Point() <= Point() >>> ================================ RESTART ================================ >>> >>> p1.add(p1) Point(6,8) >>> p1 Point(3,4) >>> p1+p2 Point(3,4) >>> p1 Point(3,4) >>> p2 Point(0,0) >>> p1+3 Point(6,7) >>> p1 Point(3,4) >>> 3+p1 Point(6,7) >>> p1 Point(3,4) >>> p1.increment(9) >>> p1 Point(12,13) >>> sum(5,6,7) Traceback (most recent call last): File "", line 1, in sum(5,6,7) TypeError: sum expected at most 2 arguments, got 3 >>> sum([5,6,7]) 18 >>> sum(3) Traceback (most recent call last): File "", line 1, in sum(3) TypeError: 'int' object is not iterable >>> max(4,5,7) 7 >>> max(4,5,7,3) 7 >>> def sum(*args): s = 0 for e in args: s+=e >>> def sum(*args): s = 0 for e in args: s+=e return s >>> sum(5,6,7) 18 >>> r1 = Rectangle1(Point(), p1) >>> r1 Rectangle with lower left Point(0,0) and upper right Point(12,13) >>> r1.area() 156 >>> r2 = Rectangle2(Point(), 5, 3) >>> r2.area() 15 >>>