Paste RqvQE

Submitted on 1 June 2016 at 11:44 UTC
2401 views

Section 1 (python)

from collections import namedtuple

Animal = namedtuple('Animal',
    [ 'species', 'name', 'call' ])

zoo = [
    Animal('dog', 'Spotty', 'woof'),
    Animal('dog', 'Fido', 'grrrr')
]

def everyone(group):
    for a in group:
        print("%s: %s" % (a.name, a.call))

everyone(zoo)

Raw · Download

Pastee