DNA to RNA Transcription

Foundational Python Foundations Transcription DNA RNA
Significance:

Transcription — copying the coding strand of DNA into mRNA by swapping thymine for uracil — is
the literal first step of the Central Dogma (DNA to RNA to Protein) that gives this platform its
name. Simulating it builds the mental model you need for every later problem involving RNA,
splicing or translation.

Statement

Given a DNA string representing the coding strand, produce the corresponding RNA string by
replacing every T with U. All other characters stay unchanged and in the same order.

Print the resulting RNA string on one line.

Input — read from standard input
Variable Type Description
t
line 1
str The coding-strand DNA sequence to transcribe
1 <= len(t) <= 1000, uppercase A, C, G, T only

These variables are already read for you in the starter code on the right.

Output

str the transcribed RNA string, on one line

Sample Cases
Sample 1
Input
GATGGAACTTGACTACGTAAATT
Expected Output
GAUGGAACUUGACUACGUAAAUU
Every T becomes U; A, C and G are untouched.
Sample 2
Input
ACGACG
Expected Output
ACGACG
No T present, so the sequence is returned unchanged.

Submit also runs your code against 4 hidden test cases. Hidden inputs are never shown — if one fails you'll get its number and a description of the mismatch, not the data.

Constraints
  • 1 <= length(t) <= 1000
  • Uppercase A, C, G, T only
Further Reading
  • A single str.replace() call is enough in Python; gsub() in R.

My Notes
Log in to save personal notes.
Console output will appear here when you click Run Code or Submit...
Expected: t (str)
Next Problem
Reverse Complement