CS1: Lecture 25 – Loops Continued
Dear students, You know that trope in movies where someone invents a new technology? At first it seems to be doing going good, but then it starts to get out of control. That’s where we are in the semester. Our software up until this point was very mild and had a limited reach. Now we […]
CS1: Lecture 24 – For Loops
Dear students, While loops put a heartbeat in our code that makes it feel alive. We can feel the CPU pulse through our data while we sit back and await the result. But while is not the only way to make code repeat. Today we consider the for loop. For Loops Last week we broke […]
CS1: Lecture 23 – While Loops Continued
Dear students, Loops turn us into pattern hunters. Behind some complex output is a much simpler machine using repetition. Let’s keep building those repetitive machines today. We’ll keep exploring while loops. While Last time we introduced while. Let’s see it at work in a few more programs. Write a program that starts with a number […]
CS1: Lecture 22 – While Loops
Dear students, Today we extend the notion of a Computer as Pilot to not just yaw left or right as it navigates through our code, but to also swoop back around to code that it has run previously. But first we examine some situations where developers write conditional statements that they shouldn’t have written. If […]
CS1: Lecture 21 – If Ladders
Dear students, Our programs have completed optional work with the diversion pattern. Our programs have chosen between two actions with the bifurcation pattern. Today we look at the making n-way choices with the ladder pattern. Ladders Suppose you’ve got an app that measures the pH of something—the food your about to ingest, perhaps. You want […]
CS1: Lecture 20 – If Bifurcations
Dear students, The software we can now write feels alive. We can get user input. We can ask questions about it. And we can respond in different ways with conditional statements. These conditional statements appear in three general forms. Last time we saw the diversion form, in which we perform some extra work when a […]
CS1: Lecture 19 – If Diversions
Dear students, We’ve seen the computer as a calculator, crunching numbers. We’ve seen the computer as a chef, calling upon recipes of code. We’ve seen the computer as a philosopher, considering truths about our data. Now it’s time to let those truths drive our computer’s actions. We will see the computer as a pilot, navigating […]
CS1: Lecture 18 – Midterm 1
Dear students, Today we have a midterm instead of our regularly scheduled lecture. I am providing a list of the methods that you may or may not need as you complete the exam. Here’s your TODO list to complete before we meet again: Homework 3 is officially assigned. It is due October 25. You must […]
CS1: Lecture 17 – Short-circuiting and Venn Diagrams
Dear students, Today’s our last day of talking about booleans as an independent idea. We will examine an unexpected behavior of our logical operator friends and then discuss one more way to visualize logic: the Venn diagram. Short-circuiting Next up we’ll examine the following piece of code. What is the output from each statement? public […]
CS1: Lecture 16 – Logic Continued
Dear students, Today we keep asking questions about data. Let’s start with some blackboxes! Blackbox #1 Blackbox #2 Blackbox #3 Blackbox #4 Blackbox #5 Blackbox #6 Now let’s do some more free-form exercises: Has digit? Does a password contain at least one digit? No attachment? Is the word “attachment” absent from the body of an […]