Sha256: 0f91facba83ebe600f551223e33a5dbd3fb7d879ee37d9d542aaadcf89ec0835

Contents?: true

Size: 1.07 KB

Versions: 19

Compression:

Stored size: 1.07 KB

Contents

parts = [('lay in', 'the house that Jack built'),
         ('ate', 'the malt'),
         ('killed', 'the rat'),
         ('worried', 'the cat'),
         ('tossed', 'the dog'),
         ('milked', 'the cow with the crumpled horn'),
         ('kissed', 'the maiden all forlorn'),
         ('married', 'the man all tattered and torn'),
         ('woke', 'the priest all shaven and shorn'),
         ('kept', 'the rooster that crowed in the morn'),
         ('belonged to', 'the farmer sowing his corn'),
         ('', 'the horse and the hound and the horn')]


def verse(verse_num):
    v = ['This is {}'.format(parts[verse_num][1])]
    v.extend(['that {0} {1}'.format(parts[i][0], parts[i][1])
              for i in range(verse_num - 1, -1, -1)])
    v[-1] += '.'
    return v


def recite(start_verse, end_verse):
    if start_verse == end_verse:
        return verse(start_verse - 1)
    else:
        result = []
        for verse_num in range(start_verse-1, end_verse):
            result.extend(verse(verse_num))
            result.append("")
        result.pop()
        return result

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
trackler-2.2.1.127 tracks/python/exercises/house/example.py
trackler-2.2.1.126 tracks/python/exercises/house/example.py
trackler-2.2.1.125 tracks/python/exercises/house/example.py
trackler-2.2.1.124 tracks/python/exercises/house/example.py
trackler-2.2.1.123 tracks/python/exercises/house/example.py
trackler-2.2.1.122 tracks/python/exercises/house/example.py
trackler-2.2.1.121 tracks/python/exercises/house/example.py
trackler-2.2.1.120 tracks/python/exercises/house/example.py
trackler-2.2.1.119 tracks/python/exercises/house/example.py
trackler-2.2.1.118 tracks/python/exercises/house/example.py
trackler-2.2.1.117 tracks/python/exercises/house/example.py
trackler-2.2.1.116 tracks/python/exercises/house/example.py
trackler-2.2.1.115 tracks/python/exercises/house/example.py
trackler-2.2.1.114 tracks/python/exercises/house/example.py
trackler-2.2.1.113 tracks/python/exercises/house/example.py
trackler-2.2.1.111 tracks/python/exercises/house/example.py
trackler-2.2.1.110 tracks/python/exercises/house/example.py
trackler-2.2.1.109 tracks/python/exercises/house/example.py
trackler-2.2.1.108 tracks/python/exercises/house/example.py