putting it all together - stanford...

122
Putting it all together (pre-midterm) CS106AP Lecture 16

Upload: others

Post on 13-Jul-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Putting it all together (pre-midterm)

CS106AP Lecture 16

Page 2: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

RoadmapProgramming Basics

The Console Images

Data structures

MidtermGraphics

Object-Oriented Programming

Everyday Python

Life after CS106AP!

Day 1!

Page 3: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Object-Oriented Programming

Object-Oriented Programming

Graphics

Images

The Console

Data structures

Everyday Python

Programming Basics

Roadmap

Life after CS106AP!

Day 1!

MidtermMidterm

Page 4: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Today’s questions

How do we use data structures in the real world?

Who will win the Bluescreen art show?

(How does your computer work? - Part 1)

Page 5: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Today’s topics

1. Review

2. Data structures + parsing applications

3. Bluescreen Art Show!

4. (How your computer works) if time

5. What’s next?

Page 6: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A quick note on the midterm

Page 7: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Download BlueBook and the correct exam beforehand.

(here)

Bring your two-step authentication devices!

Page 8: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Remember...

● We’re not trying to trick you!

● You’ve seen all of this material before and have the tools to solve the problems.

● We won’t grade you on style.

Page 9: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Common pitfalls

● Mixing up return vs. print()

● Not reading through your code/the provided code line-by-line

● Spending too much time on one problem

● Not showing your work

Page 10: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A good general strategy

● Before getting started, note down/highlight all inputs (parameters) and outputs (print/return) and their types

● To make sure you understand what you’re being asked to do, walk through an example input + output for the function/program.

● Draw diagrams (string slicing, program outlines, etc.) to help avoid bugs (e.g. off-by-one errors, not calling a function, etc.)

Page 11: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Review

Page 12: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Nested data structures

We can nest data structures!

Page 13: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Nested data structures

We can nest data structures!

● Lists in listsGrid/game board (think TicTacToe!)

X O X

X X O

O X O

Page 14: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Nested data structures

We can nest data structures!

● Lists in listsGrid/game board (think TicTacToe!) [[X, O, X],

[X, X, O],

[O, X, O]]

Page 15: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

We can nest data structures!

● Lists in lists

● Lists in dictsAnimals to feeding times

Nested data structures

Feeding times dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12:00’,‘3:00’,‘9:00’]

[‘8:00’,‘1:00’]

[‘11:00’]

[‘5:00’,‘3:00’,‘9:00’,‘2:00’]

keys (strings) values (lists)

Page 16: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Nested data structures

We can nest data structures!

● Lists in lists

● Lists in dicts

● Dicts in dictsYour phone’s contact book

{'Kylie': {'phone': 6500123445, 'address': '12 Sesame St.'},

'Nick': {'phone': 6501234567, 'address': '34 Clinton Way'},

'Sonja': {'phone': 6502345678, 'address': '56 Gerard St.'}}

Page 17: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Nested data structures

We can nest data structures!

● Lists in lists

● Lists in dicts

● Dicts in dicts

● ...and so on!

Page 18: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing nested data structures(a formula)

Page 19: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?○ Access its element as normal

Page 20: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?○ Access its element as normal

lst[i] # list: get the value at the index i

d[key] # dictionary: get the value at this key

Page 21: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?○ Access its element as normal

board[row] # get the TicTacToe row

phone_book[name] # get the contact with key name

Page 22: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

Page 23: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

board[0][0] = ‘X’

Page 24: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

board[0][0] = ‘X’

This gets the inner list

Page 25: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

board[0][0] = ‘X’

index into the list

Page 26: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

board[0][0] = ‘X’

assign the list element as normal

Page 27: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

board[0][0] = ‘X’

phone_book[‘Kylie’][‘phone’] = 6500123445

Page 28: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

board[0][0] = ‘X’

phone_book[‘Kylie’][‘phone’] = 6500123445

This gets the inner dictionary

Page 29: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

board[0][0] = ‘X’

phone_book[‘Kylie’][‘phone’] = 6500123445

This gets the value at the key phone

Page 30: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

board[0][0] = ‘X’

phone_book[‘Kylie’][‘phone’] = 6500123445

This sets the value at the key phone

Page 31: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

board[0][0] = ‘X’

phone_book[‘Kylie’][‘phone’] = 6500123445

Gets the innermost data structure

Page 32: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure?

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

You can also call any of the regular list/dict functions on the innermost data structures

e.g. board[0].append() or phone_book[‘Kylie’].items()

Page 33: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure? → list/dictionary○ Access its element as normal

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

Page 34: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure? → list/dictionary○ Access its element as normal

[1.5 Store the element in a variable (optional)]

2. What is the innermost data structure?○ Work with the element from step 1 like you normally would with

that data structure type!

Page 35: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure? → list/dictionary○ Access its element as normal

[1.5 Store the element in a variable (optional)]

first_row = board[0]first_row[0] = ‘X’ # set upper left corner to ‘X’# This is the same as board[0][0] = ‘X’

Page 36: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure? → list/dictionary○ Access its element as normal

[1.5 Store the element in a variable (optional)]

contact = phone_book[‘Kylie’]contact[‘phone’] = 6500123445# This is the same as # phone_book[‘Kylie’][‘phone’] = 6500123445

Page 37: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure? → list/dictionary○ Access its element as normal

[1.5 Store the element in a variable (optional)]

Using an intermediate variable can help make your code more readable!

Page 38: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure? → list/dictionary○ Access its element as normal

[1.5 Store the element in a variable (optional)]

You can call regular list/dict functions on the variable, too!

Page 39: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Accessing and manipulating nested data structures

1. What is the outermost data structure? → list/dictionary○ Access its element as normal

[1.5 Store the element in a variable (optional)]

2. What is the innermost data structure?○ Work with the element/element variable like you would with that

data structure type!

Page 40: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Mutability

Page 41: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

mutableA Python data type is mutable if the object

can be changed after it is created

Definition

Page 42: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Mutability and data structures

● Lists and dicts are both mutable data types

Page 43: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Mutability and data structures

● Lists and dicts are both mutable data types

● Only immutable types can be used as dictionary keys

○ e.g. strings, ints, floats, booleans

Page 44: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Mutability and data structures

● Lists and dicts are both mutable data types

● Only immutable types can be used as dictionary keys

● Immutable or mutable types can be dictionary values

Page 45: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

Mutable data structures are modified if the variables storing them are modified...

Page 46: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

Mutable data structures are modified if the variables storing them are modified...but not if you reassign that variable!

Page 47: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

Mutable data structures are modified if the variables storing them are modified...but not if you reassign that variable!

?????

Page 48: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

Mutable data structures are modified if the variables storing them are modified...but not if you reassign that variable!

?????[demo]

Page 49: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

Mutable data structures are modified if the variables storing them are modified...but not if you reassign that variable!

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12:00’,‘3:00’,‘9:00’]

[‘8:00’,‘1:00’]

[‘11:00’]

[‘5:00’,‘3:00’,‘9:00’,‘2:00’]

keys (strings) values (lists)

[demo (part 2)]

Page 50: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘11’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

feeding_dict[‘lumpy’].append(‘4’)

Page 51: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘11’, ‘4’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

feeding_dict[‘lumpy’].append(‘4’)

Page 52: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘11’, ‘4’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

feeding_dict[‘lumpy’] = [‘2’]

Page 53: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘2’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

feeding_dict[‘lumpy’] = [‘2’]

Page 54: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘2’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

[...]

[...]

[...]

[...]

Page 55: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘2’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

[...]

[...]

[...]

[...]

Each value in the dict is a list object

Page 56: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘2’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

lump_list = feeding_dict[‘lumpy’]

[...]

[...]

[...]

[...]

Page 57: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘2’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

lump_list = feeding_dict[‘lumpy’]

[‘2’]

Page 58: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘2’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

lump_list = feeding_dict[‘lumpy’]lump_list

[‘2’]

Page 59: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘2’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

lump_list.append(‘4’)lump_list

[‘2’]

Page 60: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘2’, ‘4’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

lump_list.append(‘4’)lump_list

[‘2’, ‘4’]

Page 61: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘2’, ‘4’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

lump_list = [‘5’, ‘7’]lump_list

[‘2’, ‘4’]

Page 62: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

[‘12’,‘3’,‘9’]

[‘8’,‘1’]

[‘2’, ‘4’]

[‘5’,‘3’,‘9’,‘2’]

keys (strings) values (lists)

lump_list = [‘5’, ‘7’] lump_list

[‘2’, ‘4’]

[‘5’, ‘7’]

Variable reassignment!

Page 63: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

3

4

keys (strings) values (ints)

What if the values aren’t mutable types?

Page 64: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

3

4

keys (strings) values (ints)

feeding_dict[‘lumpy’] = 4

Page 65: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

4

4

keys (strings) values (ints)

feeding_dict[‘lumpy’] = 4

Page 66: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

4

4

keys (strings) values (ints)

feeding_dict[‘lumpy’] += 1

Page 67: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

5

4

keys (strings) values (ints)

feeding_dict[‘lumpy’] += 1

Page 68: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

5

4

keys (strings) values (ints)

1

9

4

5

Page 69: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

5

4

keys (strings) values (ints)

1

9

4

5

Each value in the dict is a int object

Page 70: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

5

4

keys (strings) values (ints)

1

9

4

5

Each value in the dict is a int object

lump_val = feeding_dict[‘lumpy’]

Page 71: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

5

4

keys (strings) values (ints)

lump_val = feeding_dict[‘lumpy’]lump_val

5

Page 72: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

5

4

keys (strings) values (ints)

lump_val += 1lump_val

5

Page 73: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

5

4

keys (strings) values (ints)

lump_val += 1

5

lump_val

Since integers are immutable, a new Python object gets created!

Page 74: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

5

4

keys (strings) values (ints)

lump_val += 1

(This is the same as lump_val = lump_val + 1)

5

lump_val

Page 75: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

5

4

keys (strings) values (ints)

lump_val += 1

(This is the same as lump_val = lump_val + 1)

5

lump_val5 + 1

5

Page 76: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

5

4

keys (strings) values (ints)

lump_val += 1

(This is the same as lump_val = lump_val + 1)

5

lump_val6

5

Page 77: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

feeding_dict

‘hansa’‘kandula’‘lumpy’‘surus’

1

9

5

4

keys (strings) values (ints)

lump_val += 1

(This is the same as lump_val = lump_val + 1)

5

lump_val6

5

feeding_dict doesn’t change!

Page 78: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

Mutable data structures are modified if the variables storing them are modified...but not if you reassign that variable!

Page 79: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

Mutable data structures are modified if the variables storing them are modified...but not if you reassign that variable!

Page 80: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

Mutable data structures are modified if you use a variable to modify the data structure object itself...but not if you reassign that variable to a new data structure object!

Page 81: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

Mutable data structures are modified if you use a variable to modify the data structure object itself...but not if you reassign that variable to a new data structure object!

This means that if you pass a data structure into a function, modifying the data structure within the function

modifies the original data structure!

[demo]

Page 82: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

A note on mutability/immutability

Mutable data structures are modified if you use a variable to modify the data structure object itself...but not if you reassign that variable to a new data structure object!

This means that if you pass a data structure into a function, modifying the data structure within the function

modifies the original data structure!(this matters for Assignment 4)

Page 83: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

How do we use data structures for real-world problems?

Page 84: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

How do we use data structures for real-world problems?

Two main questions!

Page 85: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

1. What questions do we want to answer with the data?

2. Based on what we want to do, what data structures should we use to

store it?

Page 86: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Potential datasets

● All the students in CS106AP and the classes they’re currently taking

What questions do you want to answer with the data?

Page 87: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Potential datasets

● All the students in CS106AP and the classes they’re currently taking

What questions do you want to answer with the data?● What classes is an individual student taking?● How many students are taking both Engr 40A and CS106AP?● What times are different students’ classes at?

Page 88: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Potential datasets

● All the students in CS106AP and the classes they’re currently taking

What data structures should we use to store it?● What classes is an individual student taking?● How many students are taking both Engr 40A and CS106AP?● What times are different students’ classes at?

Page 89: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Potential datasets

● All the students in CS106AP and the classes they’re currently taking

What data structures should we use to store it?● What classes is an individual student taking?

○ Dictionary of lists (student names to class lists)● How many students are taking both Engr 40A and CS106AP?● What times are different students’ classes at?

Page 90: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Potential datasets

● All the students in CS106AP and the classes they’re currently taking

What data structures should we use to store it?● What classes is an individual student taking?

○ Dictionary of lists (student names to class lists)● How many students are taking both Engr 40A and CS106AP?

○ Two lists (one list for Engr40A and one for CS106AP)● What times are different students’ classes at?

Page 91: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Potential datasets

● All the students in CS106AP and the classes they’re currently taking

What data structures should we use to store it?● What classes is an individual student taking?

○ Dictionary of lists (student names to class lists)● How many students are taking both Engr 40A and CS106AP?

○ Two lists (one list for Engr40A and one for CS106AP)● What times are different students’ classes at?

○ Dictionary of dicts (student names to a dictionary of times to classes)

Page 92: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Think/Pair/Share:1. What questions do we want to

answer with the data?2. What data structures should we use

to store it?

Page 93: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Potential datasets

● All the students in CS106A and the classes they’re currently taking

● Tweets after a natural disaster from people requesting help

● Images of different coral reefs, some with coral bleaching and some without

● Government data on baby names for babies born per year

Page 94: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Potential datasets

● All the students in CS106A and the classes they’re currently taking

● Tweets after a natural disaster from people requesting help

● Images of different coral reefs, some with coral bleaching and some without

● Government data on baby names for babies born per year

1. What questions do you want to answer with the data?2. What data structures should we use to store it?

Page 95: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Potential datasets

● All the students in CS106A and the classes they’re currently taking

● Tweets after a natural disaster from people requesting help

● Images of different coral reefs, some with coral bleaching and some without

● Government data on baby names for babies born per year

Page 96: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Assignment 4: BabyNames

Page 97: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Parsing wrap-up

Page 98: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Three final functions for parsing

● f.readlines()

● lst.reverse()

● d.get()

Page 99: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Three final functions for parsing

● f.readlines()

● lst.reverse()

● d.get()

Page 100: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another file function: f.readlines()

0 The suns are able to fall and rise:

1 When that brief light has fallen for us,

2 we must sleep a never ending night.

with open(‘catullus.txt’, ‘r’) as f:

lines = f.readlines()

Page 101: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another file function: f.readlines()

0 The suns are able to fall and rise:

1 When that brief light has fallen for us,

2 we must sleep a never ending night.

with open(‘catullus.txt’, ‘r’) as f:

lines = f.readlines()

this is a list of strings!

Page 102: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another file function: f.readlines()

0 The suns are able to fall and rise:

1 When that brief light has fallen for us,

2 we must sleep a never ending night.

with open(‘catullus.txt’, ‘r’) as f:

lines = f.readlines()

lines

[‘The suns...’, ‘When that…’, ‘we must…’]

Page 103: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Three final functions for parsing

● f.readlines()

● lst.reverse()

● d.get()

Page 104: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another list function: lst.reverse()

>>> lst = [1, 2, 3, 4, 5]

Page 105: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another list function: lst.reverse()

>>> lst = [1, 2, 3, 4, 5]

>>> lst.reverse()

Page 106: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another list function: lst.reverse()

>>> lst = [1, 2, 3, 4, 5]

>>> lst.reverse()

>>> lst

Page 107: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another list function: lst.reverse()

>>> lst = [1, 2, 3, 4, 5]

>>> lst.reverse()

>>> lst

[5, 4, 3, 2, 1]

Page 108: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another list function: lst.reverse()

>>> lst = [1, 2, 3, 4, 5]

>>> lst.reverse()

>>> lst

[5, 4, 3, 2, 1]This is different from [::-1] since it changes the original list!

Page 109: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Three final functions for parsing

● f.readlines()

● lst.reverse()

● d.get()

Page 110: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another dict function: d.get()

It’s similar to d[key], but helps us avoid a KeyError if the key doesn’t exist!

d.get(key, default)

Page 111: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another dict function: d.get()

It’s similar to d[key], but helps us avoid a KeyError if the key doesn’t exist!

d.get(key, default)

If the key doesn’t exist, it will return the default value instead.

Page 112: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another dict function: d.get()

It’s similar to d[key], but helps us avoid a KeyError if the key doesn’t exist!

d.get(key)

The default parameter is optional. If left out, d.get() will return None if the key doesn’t exist.(i.e. default defaults to None)

Page 113: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another dict function: d.get()

It’s similar to d[key], but helps us avoid a KeyError if the key doesn’t exist!

>>> d = {‘a’: 3, ‘b’: 3, ‘c’: 1}

Page 114: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another dict function: d.get()

It’s similar to d[key], but helps us avoid a KeyError if the key doesn’t exist!

>>> d = {‘a’: 3, ‘b’: 3, ‘c’: 1}

>>> d.get(‘a’, 0)

Page 115: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another dict function: d.get()

It’s similar to d[key], but helps us avoid a KeyError if the key doesn’t exist!

>>> d = {‘a’: 3, ‘b’: 3, ‘c’: 1}

>>> d.get(‘a’, 0)

3

Page 116: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another dict function: d.get()

It’s similar to d[key], but helps us avoid a KeyError if the key doesn’t exist!

>>> d = {‘a’: 3, ‘b’: 3, ‘c’: 1}

>>> d.get(‘a’, 0)

3

>>> d.get(‘d’, 0)

Page 117: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Another dict function: d.get()

It’s similar to d[key], but helps us avoid a KeyError if the key doesn’t exist!

>>> d = {‘a’: 3, ‘b’: 3, ‘c’: 1}

>>> d.get(‘a’, 0)

3

>>> d.get(‘d’, 0)

0

Page 119: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

What’s next?

Page 120: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

You’ve learned so much!

● Karel● Control flow

○ Conditionals: if, if-else, if-elif-else statements

○ Loops: while, for-each, for-range

● Functions and decomposition● Variables and constants● Basic data types (integers,

floats, booleans)

● Strings● Console programs● Images● Parsing● File reading● Data structures

○ Lists○ Dictionaries○ Nested data structures

● Style best practices

Page 121: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Images

The Console

Data structures

Everyday Python

Midterm

Programming Basics

Roadmap

Life after CS106AP!

Day 1!

Graphics

Object-Oriented Programming

Graphics 1.0

Event-driven programming

Graphics 2.0

Page 122: Putting it all together - Stanford Universityweb.stanford.edu/.../16-AllTogether/16-Putting_it_all_together.pdf · Putting it all together (pre-midterm) CS106AP Lecture 16. Roadmap

Images

The Console

Data structures

Everyday Python

Midterm

Programming Basics

Roadmap

Life after CS106AP!

Day 1!

Graphics

Object-Oriented Programming

Graphics 1.0

Event-driven programming

Graphics 2.0