Problem 6.8

Transcribe DNA into RNA

Transcription is a process in the necleus, that copies the DNA sequence into messenger RNA (mRNA). The mRNA is a molecule similar to DNA with 4 nucliotide bases, but with the base Uracil (U) inplace of Thymine (T).

Write a function transcribe that takes a DNA sequence as a string and transcribe it into RNA sequence.

>>> transcribe('ATGGCT')
'AUGGCU'

>>> transcribe('AAGGCC')
'AAGGCC'

Solution

# Write a function `transcribe` that takes a DNA sequence as a string 
# and transcribe it into RNA sequence.

def transcribe(dna):
    return dna.replace("T", "U")