O'Reilly logo

Learn Python the Hard Way: A Very Simple Introduction to the Terrifyingly Beautiful World of Computers and Code, Third Edition, Video-Enhanced Edition by Zed A. Shaw

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercise 1. A Good First Program

ImageVideo: Exercise 1: A Good First Program

Remember, you should have spent a good amount of time in Exercise 0, learning how to install a text editor, run the text editor, run the Terminal, and work with both of them. If you haven’t done that, then do not go on. You will not have a good time. This is the only time I’ll start an exercise with a warning that you should not skip or get ahead of yourself.

Type the following text into a single file named ex1.py. This is important, as Python works best with files ending in .py.

ex1.py

1    print "Hello World!"2    print "Hello Again"3    

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required