Start Programming

Okay, I am assuming you have installed Python on your computer.

There are many good free tutorials available on the internet (eg. A Byte of Python and Dive into Python).

However,  I thought it would be helpful to do some basic stuff here to get us started.

1) Hello World

First open the Python IDLE – probably by going:

Start – All Programs – Python – IDLE.

This opens up the “interpreter” (or Python Shell) – you can just type Python commands in and it will do them immediately.

The cursor will be blinking at this prompt:

>>>

Type:

print(“Hello world.”)

When you press “enter”, it should display: “Hello World.”

2) Writing a program

That’s nice, but it isn’t a program yet. To do that we need to open the “editor”. From the file menu, select: “New Window”.

The editor will pop up. Now save this file as: “Hello World.py” (you might want to make a folder for your programs at this point). You have to save the program before you can run it, and it makes sense to do that first.

The cursor is now blinking in an empty box.

Type:

print(“Hello World.”)

Now save the file again (ctrl-s is quickest) and run it (F5 will do this).

The interpreter will open up a new window and display: “Hello world.”, just as it did before.

Congratulations – you are now a computer programmer!

Check back for your next lesson later!

antiloquax

Advertisements

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: