In this first week of the course, we're going to cover some core concepts of computer programming. With this, we will build a foundation to do more interesting things in the coming weeks.
What is Computer Programming?¶
Computers basically just do one thing: they complete very simple operations at astonishing speed.
Recall how in the first Python lesson we looked at the
while loop and saw how it allows us to repeat instructions to the computer as many times as you want.
The next step up from a loop is a function, which allows us to wrap up a series of commands into a single command on its own. Let's take a look at an example.read more
In this lesson, we'll think about more ways to direct Python to do things repeatedly, or conditionally.
Let's start with more loops. I showed you the while loop before, remember?
In Python, the data you work with (like the things assigned to variables) have types, which specify the kinds of data they are and the things you can do with them.
A good way to understand this is to think about the difference between letters and numbers. While we can write both down, there are different things we can do to them. It wouldn't make sense (except in an algebra context) to multiply and divide letters; it would't make sense to talk about a capital and a lowercase number 3.read more
Some kinds of data can store other kinds of data.
We've actually seen the most common complex data type a few times before, I just haven't pointed it out to you. We make a list by enclosing the elements of a list in square brackets.