July 1, 2010 13 Comments
(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).