def math_mean(myList): localList = [e for e in myList if type(e) in (int, float, long)] if not localList: return return float(sum(localList)) / len(localList) t = [2,3,10] print(math_mean(t))