Videos and Reading (online and textbook):
All of the following are required except the items labeled Optional are, well, optional
(i.e., things that may be interesting but do not directly pertain to your success in this course).
- Pair Programming
- Watch this YouTube
video on pair programming produced at North Carolina State University.
- Some people find this video a bit “over the top”,
but it explains the technique well.
- You will use Pair Programming in Session 5.
- Pair Programming is a real-life technique, per the next item.
- Skim this brief explanation of
Pair Programming as one of the techniques of Extreme Programming,
just to convince yourself that Pair Programming is very much
a real-life technique used by professionals in modern software development practices.
- Introduction to the Create Robot — Hardware
- Introduction to the Create Robot — Software (Your First Robot Program)
- Conditionals (IF statements and variants thereof) and Relational Operators
- Textbook reading: Section 3.1 — The IF Statement (pages 91 - 96, 6 pages).
Focus your attention on:
- What IF statements are, and why we need them.
- The notation for IF statements (nicely summarized in Syntax 3.1 on page 94).
- The idea and notation of compound statements and a statement block,
as seen in the example on the top of page 95.
- What belongs inside an IF statement, and what does not.
See Programming Tip 3.1 on page 96.
- Optional
textbook reading:
Special Topic 3.1 — Conditional Expressions
Python is designed for engineers to be productive.
As such, it has considerable syntactic sugar — notation
for doing something in a shorter or more elegant way than more standard notation would allow.
This section shows an example of syntactic sugar called conditional expressions,
for the adventurous among you. Your text does not use conditional expressions,
nor (probably) will we.
- Textbook reading: Section 3.2 — Relational Operators (pages 97 - 101, 5 pages).
Focus your attention on:
- The six relational operators in Table 1 on the top of page 98.
- How to use relational operators per Table 2 on the top of page 99
(pay special attention to the three common errors that it shows).
- The fact that you should not compare two floating point numbers
to see if they are equal, but rather to see if they are close enough.
See Common Error 3.2 — a critical section for any engineer!
- What it means for two strings to be equal.
- Optional
textbook reading:
Special Topic 3.2 — Lexicographic Ordering of Strings
Refer back to this section if you ever need to know the ordering of strings,
e.g. whether Daphne is less than or greater than daphne.
- Optional
textbook reading:
How To 3.1 — Implementing an IF Statement
and
Worked Example 3.1 — Extracting the Middle
Two longer examples if you feel you need them.
- Optional online reading:
Section 4.1. (if statements) from the Python Tutorials at python.org
is a nice summary for those who already know about IF statements in other languages
but need to see how to write them in Python.