The simplest program in Python consists of a line that tells the computer a command. Traditionally, the first program of every programmer in every new language prints "Hello, World!". Start up your favorite editor and save the following into a file:
print "Hello, World!"
To execute this program, save it with a suffix of '.py' (e.g., HelloWorld.py) and type 'python' and the filename in a shell like this:
> python HelloWorld.pyThe output is predictable:
Hello, World!
If you prefer to execute it by its name, instead of as an argument to the Python interpreter, put a "bang" line at the top. Include the following on the first line of the program, substituting the absolute path to the Python interpreter for /'path/to/python':
#!/path/to/pythonBe sure to give change the permission on the file to allows execution, if necessary for your operating system.
Now, let's take this program and embellish it a bit.