Download presentation
Presentation is loading. Please wait.
1
Nate Brunelle Today: Lists
CS1110 Nate Brunelle Today: Lists
2
Questions?
3
How to swap temp = lst[-1] Lst[-1] = lst[0] Lst[0] = temp
4
Last Time Nested lists Aliasing
5
Identity, Alias Alias: another name for the same thing
6
New lists vs. Aliasing Creates a new list: Creates an Alias:
List-builder: [x, y, z] Slicing: mylist[start:end:step] Casting: list(collection) Creates an Alias: Assignment: mylist = myotherlist Invoking a function: func(mylist)
7
Tips for fixing bugs in code
Know what your code should do Read error messages Believe the error message Print every variable Binary search Test more
8
Binary search begin Line1 Line2 Line3 Line4 Line5 end
Print all the variables Line2 Line3 Was it correct (if so, the problem is later) , or incorrect (if so the problem was earlier? Line4 Line5 end
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.