1 00:00:00,790 --> 00:00:03,190 The following content is provided under a Creative 2 00:00:03,190 --> 00:00:04,730 Commons license. 3 00:00:04,730 --> 00:00:07,030 Your support will help MIT OpenCourseWare 4 00:00:07,030 --> 00:00:11,390 continue to offer high-quality educational resources for free. 5 00:00:11,390 --> 00:00:13,990 To make a donation or view additional materials 6 00:00:13,990 --> 00:00:17,860 from hundreds of MIT courses, visit MIT OpenCourseWare 7 00:00:17,860 --> 00:00:19,120 at ocw.mit.edu. 8 00:00:23,520 --> 00:00:29,520 ANA BELL: So we have a class Car here, object as usual. 9 00:00:29,520 --> 00:00:35,260 The init method here takes in self as usual, a w, and a d. 10 00:00:35,260 --> 00:00:39,470 So Car gets initialized with two parameters. 11 00:00:39,470 --> 00:00:42,260 And we assign the wheels data attribute to the first one 12 00:00:42,260 --> 00:00:44,990 and the doors data attribute to the second one. 13 00:00:44,990 --> 00:00:46,700 And then we're going to also assign 14 00:00:46,700 --> 00:00:50,460 the color data attribute to be the empty string. 15 00:00:50,460 --> 00:00:52,042 So I'm giving you four choices here. 16 00:00:52,042 --> 00:00:53,750 And the question says, which of the above 17 00:00:53,750 --> 00:00:57,140 is a getter method for the number of wheels? 18 00:00:57,140 --> 00:00:59,840 So getter method is something that's 19 00:00:59,840 --> 00:01:02,250 going to get a data attribute. 20 00:01:02,250 --> 00:01:03,900 A method is really just a function. 21 00:01:03,900 --> 00:01:07,110 So of course, we're going to have def. 22 00:01:07,110 --> 00:01:10,040 get_wheels is a good name for it. 23 00:01:10,040 --> 00:01:11,610 Since it's a method for this class, 24 00:01:11,610 --> 00:01:14,520 we have to have self in the parameters. 25 00:01:14,520 --> 00:01:17,790 So we know it's going to be between C and D. 26 00:01:17,790 --> 00:01:19,950 And so then what are we going to return? 27 00:01:19,950 --> 00:01:23,547 The first one's going to return wheels, which, 28 00:01:23,547 --> 00:01:25,130 in this particular case, is just going 29 00:01:25,130 --> 00:01:29,080 to be a variable that we haven't defined, but it's a variable. 30 00:01:29,080 --> 00:01:31,310 A getter returns a data attribute 31 00:01:31,310 --> 00:01:33,270 of a particular instance. 32 00:01:33,270 --> 00:01:35,990 So we actually have to say self dot 33 00:01:35,990 --> 00:01:38,400 if we want to return a data attribute of an instance, 34 00:01:38,400 --> 00:01:40,370 as opposed to just a regular variable. 35 00:01:40,370 --> 00:01:45,110 So the correct answer is D. Great job.