weighted mean program in python