0: Hello!

New around here? Read Using this Website. You can also click here to create an account or log in.

This website teaches computer programming. This skill is very useful: with programming you can automate computer tasks, make art and music, interpret and analyze survey results, build tools for other people, create custom websites, write games, examine genetic data, connect people with each other, and the list goes on and on.

A computer program is a series of instructions, written in words, numbers and symbols. Just like any spoken sentence is in a human language like English or French, every computer program is in a programming language. A few popular programming languages are Python (what we will teach here), C++, JavaScript and PHP. We have chosen to teach Python since it is both simple enough for beginners and powerful enough to be used by modern companies. All programming languages use the same general principles, so after you know any one language, you can learn others more quickly.

Here is the first line of Python code in our lessons.

Example
This is a sample Python program. Press the Run program button to see what it does.

When you run a program you also get to see the output. The example program above only has one command, print("Hello, World!") and it created one line of output,

Hello, World!
Here is an analysis of this first program:

  • print is the name of a Python command, which sends messages to output.
  • The brackets () after the print command are used to contain what you want to print.
  • The quote marks " " are used as a container for the text Hello, World! inside. Without quotes, Python would think that Hello was meant to be a command. This would be cause an error since no such command exists.

You will learn more about the different pieces of a Python program as you progress through these lessons.

Let's see exactly what happens when we leave out the quotes.

Example
This Python program will cause an error. Press the Run program button.

Here, the program crashed: this means we gave a bad command to the computer, causing an error and forcing it to stop.

Exercise

Our first exercise is given below. It asks you to write a program similar to the first one above. Type your program into the box, and when you want to test whether your program correctly performs the task, press the Run program button. If you don't get it correct on the first try, edit the program and try running it again.

Coding Exercise: Bonjour
Write a program which prints
Bonjour, tout le monde!
(Hint: if you get stuck, copy the first program above and then edit it.)

Tip: you can make the code box look taller by dragging its bottom border.

If you have created an account and logged in,

  • we will save every version of the code that you run;
  • History shows you all versions you have submitted so far;
  • and when you visit the site again, the most recent version appears in the editor.

Once you get an exercise like this correct, you will see a checkmark appear in the top right corner of the box. If you are logged in, the Computer Science Circles website will remember which exercises you complete.

These lessons teach Python version 3. While our lessons aim to be self-contained, if you decide to search online for other information about Python, be aware that Python version 2 is also commonly used and is incompatible in some ways.

Once you are ready to go to the next lesson, click the Next button below.