Lesson 4
Repeated Practice Makes Perfect
Chapter 10: Summary
Summary
Lesson 4 is definitely one of the most intense (and probably longest) lessons we have done so far. Congratulations on getting this far. Hopefully you have found it mentally stimulating (even if mentally draining!) This was definitely the lesson where you started writing programs for real!
Quick recap. Can you answer the questions below? If not, quickly go back and find out the answers before you take your break!
- Do you remember the logical operators that I introduced in the beginning (
not
,and
,or
)? - How do you use logical operators in a conditional statement like
if
andwhile
? - Are you comfortable with while loops?
- Are you able to detect infinite loops?
- How would you avoid infinite loops?
- What do we mean by exhaustive search?
- What does the break statement do?
- Are you able to write programs without using the break statement?
- Are you more confident in your debugging skills now?
- Do you know what PEP 8 is?
- Are you aware of the style recommendations regarding whitespace, line length, and breaking lines?
- Are you aware that consistency is more important than blindly following the PEP 8 guidelines?
This lesson was also different from previous lessons as you actually spent more time actually trying to develop algorithms and solve problems, which is a key emphasis of our course.
- You have developed and implemented an algorithm to estimate the square root of a number by exhaustive search.
- You have also implemented an existing algorithm to estimate the square root, and you have also seen that it can sometimes be good to reinterpret an algorithm rather than implement it blindly.
- You have also implemented a prime number validator and a prime number generator.
- You have also managed to improve your robot project to be able to automatically navigate all the way to a certain grid cell. Well done!
You have explored how to view your history of Git commits with git log.
At this stage, we have recapped all the topics I have discussed back in Lesson 1 in much more detail. At this point, you should already have all the tools you need to write almost any program (even if your program may not be efficient).
Now that we have covered the basics of the basics, in the next lessons I will start giving you better tools that will make it much easier to write more complex programs. You will begin to write code that is more readable, easier to maintain, efficient, elegant, and hopefully with less pain.
Now, take a break! You have earned it! Go relax, move, play! I would say take at least 30 minutes of break. Your brain needs time to consolidate what you have learnt. In fact, your brain is still working in the background when you are not thinking too hard about a problem.
See you in the next lesson!