New median function in stats.py

I added a median function.