ipython notebook does a good job of this. Good for learning, and code exploration.
Unfortunately, it's a bit of a pain to setup. If you're just getting started you might want to consider installing the pythonXY package of python, it includes ipython notebook and a bunch of other useful libraries in addition to the standard libraries.
Here's a good introduction (ipython notebook starts at about 1:15:45):
http://www.youtube.com/watch?v=2G5YTlheCbw