Sha256: 3fddc291976331bc32691a8feac65cb07c37763b97c9761a3a1dc4111bb25681

Contents?: true

Size: 383 Bytes

Versions: 108

Compression:

Stored size: 383 Bytes

Contents

NUCLEOTIDES = 'ATCG'


def count(strand, abbreviation):
    _validate(abbreviation)
    return strand.count(abbreviation)


def nucleotide_counts(strand):
    return {
        abbr: strand.count(abbr)
        for abbr in NUCLEOTIDES
    }


def _validate(abbreviation):
    if abbreviation not in NUCLEOTIDES:
        raise ValueError('{} is not a nucleotide.'.format(abbreviation))

Version data entries

108 entries across 108 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.179 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.178 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.177 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.176 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.175 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.174 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.173 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.172 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.171 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.170 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.169 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.167 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.166 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.165 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.164 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.163 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.162 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.161 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.160 tracks/python/exercises/nucleotide-count/example.py