Hello world!


Your first program, for reasons lost to the mists of time, must always be a “hello world!”  If you don’t do it, something bad will happen to you (or one of your friends, relatives, distant relatives, acquaintances or some other citizen of your country).  Believe me, it is scary.

So, to avoid such a horrible fate, repeat after me:

>>> print 'hello world!'
hello world!
>>>

Phew! We’re done.    You should notice that the print statement here did something – it printed the letters between the ” (inverted commas) and it printed them on the next line.  Try it for yourself, but remember to press the enter key at the end otherwise nothing will happen.

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

About these ads

9 Responses to Hello world!

  1. jeremynealbrown says:

    Excellent idea for a blog! Python is a fun language and a great place to start learning how to write software. Looking forward to future posts :)

  2. MeneM says:

    Oh dear, with the new python 3.2 this results in a SyntaxError…

    Now it should read:
    >>> print(‘hello world’)
    hello world

  3. brendanscott says:

    @MeneM:
    These tutorials are based on Python 2.6/2.7. Substantial changes happened to the language with version 3. Print, in particular, won’t work but other stuff might not as well. If you want to follow the tutorials, you should get a copy of the 2.7 branch. See: http://python4kids.wordpress.com/getting-started/.

  4. MeneM says:

    Ah ok, makes sense, but isn’t 2.6/2.7 older now? Surpassed by the updates?

  5. Dharmit Shah says:

    That’s the most hilarious Hello World example I have ever come across!

  6. Pingback: python4kids 一個老爸教8歲的兒子寫python所用的blog » Kevinwatt's Blog

  7. Alex Harper says:

    Squee! This was my very first program, and I stayed up ’till bedtime going through the first 4 tutorials. I’m going to have Python down pat by the end of the summer holidays! :)

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

Follow

Get every new post delivered to your Inbox.

Join 69 other followers

%d bloggers like this: