I won't waste time with theory or syntax right now, as I am presuming you have some programming experience, if not these things can be learnt elsewhere. Anyway, I often think it's best to learn by getting your hands dirty so lets get started. Once you can code a hello world app, you are only a few steps from doing anything you want.
#!/bin/python
print "Hello, world!"
Just enter these lines to an empty file, either in your IDE or your text editor. Then you just need to make the file executable by giving the it a chmod +x command and run it: chmod -x filename.py For more information on the chmod command, please read this Bright Hub article here.
Line one tells the interpreter to run the code below. In the second line, we print the text that we want to return, in this case "Hello, world!" Since there are no lines after this, the program will quit.
A useful feature with print is, multi-line printing, which can be used for printing any kind of multi-line text. Again enter the top line to tell the Python Interpreter to execute the code below. Then start the block with triple quotes, and end with triple quotes, like this:
#!/bin/python
print """
Line one.
Line two.
Line three.
"""