Hello world!

(Works for both Python 2.7 and Python 3)
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).

15 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:

    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: https://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! 🙂

  8. Pingback: Python (Computer Coding) | The Chronicles of Nerdium

  9. Pingback: 3: Hello World! | Python Tutorials for Kids 13+

  10. Adeus Rugas says:

    Beautiful articles, I’m shopping on Facebook!

  11. Pingback: click for more

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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: