Transcript

the following content is provided under a Creative Commons license your support will help MIT open courseware continue to offer highquality educational resources for free to make a donation or view additional materials from hundreds of MIT courses visit MIT opencourseware at ocw.mit.edu let's let's walk through it we have three lists L1 is equal to Ray L2 is equal to me L3 is equal to do L4 is equal to let's just do what it what it says here L1 plus L2 so it's going to be the list Ray me uh yeah me now extend is going to mutate the list so that means L3 is going to be extended by whatever L4 is so L3 is going to be okay what did it have originally it had do do and then it's going to be extended by all of the elements inside L4 which is Ray me like that and once I've mutated it the old version of L3 is gone right this is this is the L3 down here that I'm going to work with l3.

sort is going to sort alphabetically so that's do me Ray yep and sort also mutates the list so the old version of the list I have is gone Dell is going to also mutate the list so it's going to look in L3 look at index zero and it's going to delete that that um it's going to delete that element so it's going to mutate L3 and it's going to be me Ray okay and once again I've mutated the list so the old version's gone and lastly this is a tricky part I'm going to append to my current L3 which looks like this another list so to L3 I'm appending another list so this is going to be the list fa la okay so meay and then the list FAA is the answer which is red no sorry blue good you had me scared okay perfect so if you didn't get this I would suggest you go through the python tutor or you just trace it out by hand just like I just did um and hopefully it'll be sort of a parent the more uh the more exercises you do with lists what exactly is going on okay