Computer Science Circles | 01000011 01010011 01000011

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, […]


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.

If you would like a more gradual, video-based presentation to Python, you may want to examine Python from Scratch, offered by the University of Waterloo. There is also a video series on Language Independent Programming Lessons which can be a useful supplement.

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.

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 parentheses () 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.

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.

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.

Source Article

Next Post

Free Technology for Teachers

WriteReader is a great tool for creating multimedia stories that I’ve featured a half dozen times or more over the years. The last time I wrote about it they had just added some new page styles. Last week WriteReader unveiled a new feature that I think a lot elementary school […]
vortex-webdesign.com WordPress Theme: Seek by ThemeInWP