Download presentation
Presentation is loading. Please wait.
1
Nate Brunelle Today: Style, Collections
CS1110 Nate Brunelle Today: Style, Collections
2
Questions?
3
Last Time Debugging Slicing
4
Style You should write code to be read by humans Docstrings Names Pep8
Have information at beginning of functions to describe what it does Names A name should describe the meaning Can be hard Make sure there is one meaning per variable Pep8 Other Python style guidelines Talks about things that aren’t names or docstrings, but make code ugly
5
Collections Order doesn’t matter, No Repetition
Order Matters, Repetition ok Examples: String List Tuple Range Counting starts at 0 collection[index] gives a specific value in the collection Order doesn’t matter, No Repetition Examples: Set Dict
6
Ordered Collections Collection What it can hold Syntax to create
Mutable? String characters ‘’ immutable Range ints range Tuple Anything ( , ) List [ , ] mutable
7
Methods that Mutate Lists
append(element) remove(element) pop(i)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.