# DKUUG PYTHON LECTURE March 25 2008
# Copyright 2008 Svenne Krap. 
# This software is released under the BSD license.
# Please see the attached license

import random
from pprint import pprint

names = ['Hans', 'Jens','Bent','Charlie','Niels','Ole','Flemming','Anders','Mads','Kim']

people = []

for n in names:
    people.append( (n, random.normalvariate(180,5)))


def by_name(a, b):
    if a[0] > b[0]: return 1
    if a[0] < b[0]: return -1
    return 0

def by_height(a, b):
    if a[1] > b[1]: return 1
    if a[1] < b[1]: return -1
    return 0

pprint(people)
people.sort(by_name)
pprint(people)
people.sort(by_height)
pprint(people)

