|
|
|
Questions
|
|
|
|
|
sys.exit()
|
|
|
|
|
Quiz
|
|
|
|
|
after time, use back page to answer
|
|
|
|
|
how is the course going for you, 1–5
|
|
|
|
|
what is one thing Aaron could do differently to improve your learning
|
|
|
|
|
what is one thing that Aaron should keep doing that helps your learning
|
|
|
|
|
HW2
|
|
|
|
|
prisoner2.py and prisoner3.py
|
|
|
|
|
history.py
|
|
|
|
|
def strat(my_history, other_history)
|
|
|
|
|
how would strat check if its opponent defected last round?
|
|
|
|
|
what if this is the first round?
|
|
|
|
|
how would strat check if its opponent defected in any of the last three rounds?
|
|
|
|
|
Functions as data
|
|
|
|
|
max(history1, history2)
|
|
|
|
|
how to compare?
|
|
|
|
|
can pass max a function that it will use as criteria
|
|
|
|
|
def history_length(history): return history.get_length() max(history1, history2, key=history_length)
|
|
|
|
|
def make_rounder(digits): def new_round(num): return round(num, digits) return new_round
round3 = make_rounder(3) print(round3(3.1416)) # prints 3.142
|
|
|