Skip to content

Instantly share code, notes, and snippets.

View andrix's full-sized avatar

Andrés Moreira andrix

View GitHub Profile
@andrix
andrix / avg.orig.py
Created December 30, 2011 01:03 — forked from rmax/avg.orig.py
pythonic vs non-pythonic code
from __future__ import division
def c_avrg(the_dict, exclude):
""" Calculate the average excluding the given element"""
i = 0
total = 0
for e in the_dict:
if e != exclude:
i += 1
total += the_dict[e]