Overview
This week we will explore functions in Python and learn how to use our new doctest tool to communicate clearly about our functions.
Friday, October 27th
Daily PCEP Warm Up Question
What is the expected output of the following code?
something = 5 for r in range(1, 6): for c in range(-1, 3): if r == c: something += 2 else: continue else: something -= 1 print(something)
Classwork
I will discuss solutions to the remove_a_letter
problem from
Chapter 4 Exercise Set 0. (Thanks Sean, for asking for this!)
We can then discuss any other problems from the homework that you would like to discuss.
Homework
Study for the retake quiz next Tuesday at the start of class.
Wednesday, October 25th
Daily PCEP Warm Up Question
What happens when the user runs the following code?
var = -2 for x in range(-1, 2): if 2 * x < 4: var += 1 else: var += 2 print(var)
Classwork
We will start class today by discussing solutions to the exercies from Chapters 3 and 4 assigned for homework.
We will then discuss Chapter 5: Functions in order to prepare you for your homework.
Homework
Complete Chapter 5 Exercise Set 0: Chapter Review and be ready to present your solutions when you come to class on Wednesday.
Monday, October 25th
Daily PCEP Warm Up Question
What is the expected output of the following code?
expression = -1 ** 4 + 2 * 4 // 5 if expression < 0: print('@') elif expression > 2: print('@@') else: print('@@@')
Classwork
I am out sick today, so we will have to wait until Wednesday to go over solutions to both the exercises assigned last Thursday and those assigned today.
You will have time to work on the classwork / homework exercsies from Chapter 4: Conditionals and loops.
Homework
Complete as many of the exercises from Chapter 4 Exercise Set 0: Chapter Review and Chapter 4 Exercise Set 1: PCEP Practice as time allows.