You are viewing a single comment's thread. Return to all comments →
My way in Python 3. Could be simpler, but it seems clear to me and anyway I'm not good enough to think of all these one-liner solutions yet!
def average(array): heights = set(array) averg = sum(heights) / len(heights) return averg
Seems like cookies are disabled on this browser, please enable them to open this website
Introduction to Sets
You are viewing a single comment's thread. Return to all comments →
My way in Python 3. Could be simpler, but it seems clear to me and anyway I'm not good enough to think of all these one-liner solutions yet!