[Blog] Day 68/100: Reading / Exercism

Craig Maloney at 2017-08-11T20:00:20Z

(http://feedproxy.google.com/~r/CraigMaloney/~3/DzHix_IF5r8/)

Did a quick play around with Exercism and some reading.

Here's my solution for RNA Transcription in Python:

def to_rna(dna):
    dna_rna_trans = {'G': 'C', 'C': 'G', 'T': 'A', 'A': 'U'}
    rna_strand = []
    dna_list = list(dna)
    for dna_nucleotide in dna_list:
        if dna_nucleotide not in dna_rna_trans:
            return ''
        else:
            rna_strand.append(dna_rna_trans[dna_nucleotide])

    return ''.join(rna_strand)