Sha256: 7717e2789027f93f544c96d8fd3d6b71e1f1ef7425d2065163ef08688bee5d57

Contents?: true

Size: 286 Bytes

Versions: 227

Compression:

Stored size: 286 Bytes

Contents

def slices(series, length):
    numbers = [int(digit) for digit in series]
    if not 1 <= length <= len(numbers):
        raise ValueError("Invalid slice length for this series: " + str(
            length))
    return [numbers[i:i + length] for i in range(len(numbers) - length + 1)]

Version data entries

227 entries across 227 versions & 1 rubygems

Version Path
trackler-2.2.1.137 tracks/python/exercises/series/example.py
trackler-2.2.1.136 tracks/python/exercises/series/example.py
trackler-2.2.1.135 tracks/python/exercises/series/example.py
trackler-2.2.1.134 tracks/python/exercises/series/example.py
trackler-2.2.1.133 tracks/python/exercises/series/example.py
trackler-2.2.1.132 tracks/python/exercises/series/example.py
trackler-2.2.1.131 tracks/python/exercises/series/example.py
trackler-2.2.1.130 tracks/python/exercises/series/example.py
trackler-2.2.1.129 tracks/python/exercises/series/example.py
trackler-2.2.1.128 tracks/python/exercises/series/example.py
trackler-2.2.1.127 tracks/python/exercises/series/example.py
trackler-2.2.1.126 tracks/python/exercises/series/example.py
trackler-2.2.1.125 tracks/python/exercises/series/example.py
trackler-2.2.1.124 tracks/python/exercises/series/example.py
trackler-2.2.1.123 tracks/python/exercises/series/example.py
trackler-2.2.1.122 tracks/python/exercises/series/example.py
trackler-2.2.1.121 tracks/python/exercises/series/example.py
trackler-2.2.1.120 tracks/python/exercises/series/example.py
trackler-2.2.1.119 tracks/python/exercises/series/example.py
trackler-2.2.1.118 tracks/python/exercises/series/example.py