You need to put the location of the program to execute your code on the first line and you then need to set the script to run as an executable by changing its permissions. This assumes you're launching your applications from terminal or another script.
Find your Python installation
$ which python
Add the programs location to the top line of your program with a
#! in front
# Python code goes here....
Set the Python script to have execution rights
$ chmod 700 test.py
Now you can run the script directly
Code listing for test.py