The Scripting Layer For Android (SL4A) is a library that allows you to create and run scripts inside your android device itself. This was released a long while back and is made for developers and it has access to many APIs with a simple interface. Scripts can be run in the terminal , background or via Locale .After you install the scripting environment you will have Shell by default .
The supported languages include: Python, Perl, JavaScript, BeanShell, PHP, Ruby, Lua, Tcl, Rhino.
To download SL4A : Click here
If you want to install python or any other languages through sl4a or manually go to the SL4A webpage and download the interpreters and install them manually.
SOURCE: Scripting For Android