Lecture Four -- Outline
Learning Objectives
We have a style guide, use it!
How to write good test cases of your own
Problem solving - lots of ways to solve the same problem
Announcements
Ant man - what time do you need to leave recitation?
Read the write-up carefully
HW4 -- will be released today, due Monday (unless it's very stressful, then it will be due Tuesday)
Piazza Posts - read them :)
No office hours Friday nights
Lending Library -> Check out some of my books!
Lecture feedback -- let's make lecture better!
Positive Learning Environment
More fun stuff + applications to functions
List of functions written in lecture after lecture
Quiz on Monday
Structure will be 2 CT's, 1-2 ROC's, and 2 FR
FR worth the most points, do those first
CT and ROC are fully answer based, show your work
Lots of practice on the website
Lecture Plan
[9:00] Announcements
[9:05] Leftovers from yesterday
split and splitlines
string formatting
file i/o
[9:10] Magic Trick
Parity Bit -- error checking
[9:15] Style, Testing and Debugging -- why do we care?
Famous Software Bugs
[9:20] Style
Make fun of Tara's hw1.py with no comments or well-named variables
[9:30] Writing Test Cases
Let's catch a buggy testPigLatin
Console/Graphics -> don't worry about this for now
Exceptions (from course notes)
[9:45] The 3 different types of errors
[9:50] Debugging Strategies
Avoiding bugs
Good style!
Write tests before you code
Each function has one task
Copy/pasting == bad
In general
Read the error message + line number
Bottom of stack trace
Syntax Errors (see course notes)
Where is the arrow pointing?
Forgetting a colon, indent, parenthesis, quote, = instead of ==
When can this be tricky?
Runtime Errors
String/index errors
Typo in variable name
Infinite loops
Operation on an inappropriate type
Dividing by 0
Reading a file that doesn't exist...
[10:00] Practice Free Response -- encodeRightLeftCipher
If there is time, how would we decode this?
[10:18]
Attendance Check
HW4
Released today!
Up Next
Lists!