Calling Python Function from Console
If you name your script *.py in the text editor you can import it in the console as a module.

Beware - after you imported the script for the first time you can't import it again. If you make changes to the module you can use imp.reload or importlib.reload (for blender versions > 2.71 using python 3.4)