Home » PythonPi Introductory Course » PythonPi: Lesson Two

PythonPi: Lesson Two

Now then, you’ve got your Raspberry Pi up and running with Raspbian, fortunately for you, that’s the installing pretty much done for now. We can delve straight into having some fun with Python because the language is actually pre-installed because it is the official language of the Raspberry PI. Great, let’s get started with Python then.

Python is a programming language. Programming languages are how we communicate with computers. Tell them what to do. In the olden days people used to use punch cards, individually punching through long pieces of card then feeding them into a slot in the computer. Now it’s a lot less painful than that. In fact you can make a program pretty easy just by knowing a few simple rules. These rules are known as Syntax, however we won’t try and use to many technical words this early on in the course.

On your Raspberry Pi, open up the Python IDLE3 from the programming section of the program menu.

This will present you with something known as the shell. From here we can type commands to the computer and make it do as we please.

Our first program is going to be learning how to tell the computer to print or display a set of words on the screen.

Type into the window:

3 + 6

and then press the enter button. You should get the result:

9

If you did, great! You’ve just written your first ever Python command. Maths functions like the ones on a calculator are really easy using Python.

The next part of this lesson will involve words. In computer programming languages, we call a set of words that are bundled together, like a sentence, a “string”.

Let’s print out a string on the Python Shell.

Type:

print(“Hello, World!”);

Then press the enter key and you should see the text “Hello, World!” without the quote marks or the text surrounding the string.

That was called a print function and it’s very handy for making text applications and finding problems in your code.

 


Leave a comment

Your email address will not be published. Required fields are marked *