Objects Objects are values that behave like what it’s supposed to represent Ex: datetime module from datetime import date date datetime.date In datetime, date is a class that literall...
CS61A: Mutability
CS61A: Lecture 14
Mutability In the way that names refer to values, we can have multiple names refer to the same values The names declared within functions may also refer to values outside of the scope...
CS61A: Trees
Trees A data abstraction used for representing hierarchical relationships. Two different metaphors of a tree: Recursive description (wooden trees): ...
CS61A: Data Abstraction
Data Abstraction Compound objects combine objects together A date: a year, a month, and a day A geographic position: latitute and longitude An abstract data type lets use ...
CS61A: Lecture 13
Data Abstraction Not inherently implemented within the python interpreter. A set of behaviors defined by the programmer. We may refer to the data and the parts without any worry about...
CS61A: Lecture 12
Manipulating Lists Making a list with a list literal Get a certain element using item selection Get a portion of the list using slicing Make a longer list using addition s = [4, 7, 9, 11...
CS61A: Lecture 11
Manipulating Lists Making a list with a list literal Get a certain element using item selection Get a portion of the list using slicing Make a longer list using addition s = [4, 7, 9, 11...
CS61A: Lecture 11
Containers List Comprehension practice First in Line Implement promoted, which takes a sequence s and a one-argument function f. It returns a list with the same elements as s, but with all ele...
CS61A: Containers
Box-and-Pointer Notation Means of expressing lists within environmental diagrams The Closure Property of Data types. Sequential data is complicated to represent. A method for combining da...
CS61A: Sequences
Lists Built-in dat type in Python. Lists are created with a list literal Lists have a 0-based indexing system. This means that the length of the list is always on...