3: Hello World!


For those of you interested in learning Python 3, I’m going to start revisiting old blog posts, updating them for Python 3. They might, but probably won’t, be repeating the same order as the original. Python 3 posts will start with a 3 (in case you hadn’t worked out the 3: at the start of this posts’ title).  To do these posts I’m assuming that you’ve:

  1. Installed a version of Python starting with 3 (if you have a version starting with 2, start here).  If you haven’t installed it, follow the instructions on the Getting Started page.
  2. Managed to open Python (command line). You can also use the IDLE editor (and you’ll get onto that later anyways).

For some reason, lost to the mists of time, the first program you write in any language is supposed to be a program, called “Hello World”, that gets the computer to say “hello world”.    So here it is. Open up your Python prompt. You should see something like this:

>>>

That thing’s the Python prompt.  Type everything after the >>> in the first line here:

>>> print('hello world!')
hello world!
>>>

When you press the Enter* button at the end of the first line, “hello world!” appears on the next line.  Make sure that you type:

print('hello world!')

in exactly. That is,  (don’t type >>>) but make sure you include the (, ‘, ‘ and ).  If you leave any of them out, it won’t work (try it).

Congratulations, you’re now a programmer (in training).

 

*  If you are on a Mac, think “Return Button” whenever I say  Enter button.

 

One Response to 3: Hello World!

  1. Pingback: 3: Getting Input | Python Tutorials for Kids 13+

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: