Python 3.1.1+ (r311:74480, Nov 2 2009, 14:49:22) [GCC 4.4.1] on linux2 Type "copyright", "credits" or "license()" for more information. >>> >>> >>> aList = [45,6] >>> >>> aList.append(True) >>> >>> result = aList.append("test") >>> type(result) >>> >>> aList [45, 6, True, 'test'] >>> aList = aList.append(10) >>> >>> aList >>> type(aList) >>> >>> >>> >>> >>> aList = [] >>> >>> aList [] >>> aList + [45,10] [45, 10] >>> >>> newList = aList + [45, True, "Testing"] >>> >>> newList [45, True, 'Testing'] >>> aList [] >>> aList = newList >>> aList [45, True, 'Testing'] >>> >>> aList = aList + [5] >>> >>> aList [45, True, 'Testing', 5] >>> >>> >>> >>> >>> aList = aList + 10 Traceback (most recent call last): File "", line 1, in aList = aList + 10 TypeError: can only concatenate list (not "int") to list >>> >>> >>> aList.append(10) >>> >>> aList [45, True, 'Testing', 5, 10] >>> >>> >>> aList [45, True, 'Testing', 5, 10] >>> aList = [1,2] >>> >>> aList + [ 5 ] [1, 2, 5] >>> >>> >>> aList [1, 2] >>> newList = aList + [5] >>> >>> aList = aList + [4] >>> aList [1, 2, 4] >>> >>> >>> >>> aList.append(5) >>> >>> aList [1, 2, 4, 5] >>> =========================== RESTART =========================== >>> >>> p = Point(1,2) You made a point! The total number of points is: 1 >>> p2 = Point(4,7) You made a point! The total number of points is: 2 >>> Point.numPoints 2 >>> p3 = Point(10,15) You made a point! The total number of points is: 3 >>> p.printMe() 1,2 >>> p2.printMe() 4,7 >>> p2.__eq__(p) False >>> >>> p2 == p False >>> =========================== RESTART =========================== >>> >>> p = Point(5,10) You made a point! The total number of points is: 1 Traceback (most recent call last): File "", line 1, in p = Point(5,10) TypeError: __init__() should return None, not 'int' >>> =========================== RESTART =========================== >>> >>> p = Point(1,2) You made a point! The total number of points is: 1 >>> p2 = Point(4,7) You made a point! The total number of points is: 2 >>> >>> p == p2 6 >>> >>> >>> 6 == True False >>> >>> >>> 0 == True False >>> 1 == True True >>> >>> >>> (p == p2) + 1 7 >>> >>> >>> p.printMe() 1,2 >>> printMe() Traceback (most recent call last): File "", line 1, in printMe() NameError: name 'printMe' is not defined >>> >>> >>> p.printMe() 1,2 >>> >>> Point.printMe() Traceback (most recent call last): File "", line 1, in Point.printMe() TypeError: printMe() takes exactly 1 positional argument (0 given) >>> Point.printMe(p) 1,2 >>> >>> Point.printMe(p2) 4,7 >>> >>> >>> printMe() Traceback (most recent call last): File "", line 1, in printMe() NameError: name 'printMe' is not defined >>> >>> Point.printMe(p) 1,2 >>> >>> p.printMe() 1,2 >>> Point.printMe(p) 1,2 >>> >>> import math >>> math.sin(-1) -0.8414709848078965 >>> >>> >>> >>> >>> =========================== RESTART =========================== >>> You made a point! The total number of points is: 1 You made a point! The total number of points is: 2 >>> =========================== RESTART =========================== >>> You made a point! The total number of points is: 1 You made a point! The total number of points is: 2 False >>> import Point You made a point! The total number of points is: 1 You made a point! The total number of points is: 2 False >>> >>> >>> p2 = Point(5,10) Traceback (most recent call last): File "", line 1, in p2 = Point(5,10) TypeError: 'module' object is not callable >>> >>> =========================== RESTART =========================== >>> You made a point! The total number of points is: 1 You made a point! The total number of points is: 2 False >>> p <__main__.Point object at 0x984520c> >>> p2 <__main__.Point object at 0x984556c> >>> p3 = p + p2 You made a point! The total number of points is: 3 >>> >>> p3.printMe() 15,15 >>> c = Circle(1,1,10) You made a point! The total number of points is: 4 >>> >>> >>> c.printMe() 1,1 >>> >>> >>> p <__main__.Point object at 0x984520c> >>> p.printMe() 5,5 >>> p + c You made a point! The total number of points is: 5 <__main__.Point object at 0x9845a2c> >>> >>> newPoint = p+c You made a point! The total number of points is: 6 >>> newPoint.printMe() 6,6 >>> type(newPoint) >>> >>> >>> c== p False >>> c.x 1 >>> c.y 1 >>> p.x 5 >>> p.y 5 >>> p.x = 1 >>> p.y = 1 >>> c == p True >>> >>> >>> c.numPoints 6 >>> Point.numPoints=10 >>> c.numPoints 10 >>> >>> >>> p <__main__.Point object at 0x984520c> >>> p2 <__main__.Point object at 0x984556c> >>> >>> >>> p2.x = 17 >>> >>> >>> px.printMe() Traceback (most recent call last): File "", line 1, in px.printMe() NameError: name 'px' is not defined >>> p2.printMe() 17,10 >>> >>> >>> >>> fIn = open("asotv.csv", "r") >>> >>> >>> data = fIn.read() >>> fIn.close() >>> >>> data 'Date, ShamWow, Cami Lace, Instant Switch, Flowbee \nMonday, 1232, 3221, 638, 893\nTuesday, 1532, 2832, 543, 789\nWednesday, 1132, 3148, 593, 827\nThursday, 1341, 2944, 601, 832\nFriday, 1242, 1234, 621, 794\n' >>> >>> >>> >>> >>> fIn = open("asotv.csv", "r") >>> >>> lines = fIn.readlines() >>> fIn.close() >>> >>> lines ['Date, ShamWow, Cami Lace, Instant Switch, Flowbee \n', 'Monday, 1232, 3221, 638, 893\n', 'Tuesday, 1532, 2832, 543, 789\n', 'Wednesday, 1132, 3148, 593, 827\n', 'Thursday, 1341, 2944, 601, 832\n', 'Friday, 1242, 1234, 621, 794\n'] >>> lines[0] 'Date, ShamWow, Cami Lace, Instant Switch, Flowbee \n' >>> lines[1] 'Monday, 1232, 3221, 638, 893\n' >>> lines[2] 'Tuesday, 1532, 2832, 543, 789\n' >>> lines[4] 'Thursday, 1341, 2944, 601, 832\n' >>> lines[5] 'Friday, 1242, 1234, 621, 794\n' >>> friday = lines[5] >>> >>> friday 'Friday, 1242, 1234, 621, 794\n' >>> "this is a string".split() ['this', 'is', 'a', 'string'] >>> >>> >>> >>> >>> friday.split() ['Friday,', '1242,', '1234,', '621,', '794'] >>> >>> >>> >>> >>> >>> friday.split(",") ['Friday', ' 1242', ' 1234', ' 621', ' 794\n'] >>> >>> fridayData = friday.split(",") >>> >>> fridayData[0] 'Friday' >>> fridayData[1] ' 1242' >>> fridayData[2] ' 1234' >>> >>> >>> fridayData[1] ' 1242' >>> >>> int( fridayData[1] ) 1242 >>> >>> >>>