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.159 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.158 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.157 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.156 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.155 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.154 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.153 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.152 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.151 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.150 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.149 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.148 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.147 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.146 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.145 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.144 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.143 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.142 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.141 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.140 tracks/python/exercises/nucleotide-count/example.py