Skip to content

Instantly share code, notes, and snippets.

@Roxiun
Created December 8, 2019 10:09
Show Gist options
  • Save Roxiun/f1f7b4d1feb18e7626c465d7f38d01dd to your computer and use it in GitHub Desktop.
Save Roxiun/f1f7b4d1feb18e7626c465d7f38d01dd to your computer and use it in GitHub Desktop.
import string
dna_letters = "ATGC" #All possible DNA letter
rna_letters = "UACG" #All possible RNA Letters
dna = input("Please enter you DNA string: ") #Gets DNA Input
dna = dna.upper() #Changes DNA to uppercase if not already
print(f"Your DNA sequence is: {dna}") #Prints the DNA Sequence
rna = "" #Creates a blank variable
for letter in dna: #For ever letter in DNA it loops
for i in range(4): #Loops 4 times since there is only 4 possible letters
if letter == dna_letters[i]: #If hat index is the same as one of the letters
rna += rna_letters[i] #Adds the RNA version of it to the variable
print(f"Your messenger RNA strand is: {rna}") #Prints the Final RNA sequence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment