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.139 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.138 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.137 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.136 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.135 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.134 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.133 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.132 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.131 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.130 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.129 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.128 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.127 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.126 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.125 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.124 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.123 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.122 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.121 tracks/python/exercises/nucleotide-count/example.py
trackler-2.2.1.120 tracks/python/exercises/nucleotide-count/example.py