title: Why can't I convert DNA to mRNA in python?
body: <p>Code:</p>
  
  <pre class="lang-py prettyprint-override"><code>n = 3
  
  DNA-Sequence = { #dictionary of DNA
      "Phenylalanine": ["UUU", "UUC"],
      "Leucine": ["UUA", "CUU", "CUC", "CUA", "CUG", "UUG"],
      "Isoleucine": ["AUU", "AUC", "AUA"],
      "Methionine": "AUG",
      "Valine": ["GUU", "GUC", "GUA", "GUG"],
      "Serine": ["UCU", "UCC", "UCA", "UCG"],
      "Proline": ["CCU", "CCC", "CCA", "CCG"],
      "Threonine": ["ACU", "ACC", "ACA", "ACG"],
      "Alanine": ["GCU", "GCC", "GCA", "GCG"],
      "Tyrosine": ["UAU", "UAC"],
      "Histidine": ["CAU", "CAC"],
      "Glutamine": ["CAA", "CAG"],
      "Asparagine": ["AAU", "AAC"],
      "Lysine": ["AAA", "AAG"],
      "Asparatic Acid": ["GAU", "GAC"],
      "Glutamic Acid": ["GAA", "GAG"],
      "Cysteine": ["UGU", "UGC"],
      "Trytophan": "UGG",
      "Arginine": ["CGU", "CGC", "CGA", "CGG", "AGG", "AGA"],
      "Serine": ["AGU", "AGC"],
      "Glycine": ["GGU", "GGC", "GGA", "GGG"]
  }
  
  lookup_dict = {k: key for key, values in DNA-Sequence.items() for k in values} #this is used to find the values in the dictionary using the inputDNA
  inputDNA = input("Enter your DNA sequence: ")
  inputDNA = inputDNA.upper()
  print("Your DNA sequence is", inputDNA)
  str(inputDNA)
  RNA = inputDNA.replace('C', 'G') #this is me trying to convert DNA sequence to RNA
  RNA = RNA.replace('A', "U") #this is me trying to convert DNA sequence to RNA
  RNA = RNA.replace('T', 'A') #this is me trying to convert DNA sequence to RNA
  print(RNA)
  
  b = len(inputDNA)
  
  if b % 3 == 0: #if the length of inputDNA is a multiple of 3
    for k in (inputDNA[i:i + n] for i in range(0, len(inputDNA), n)):
      for _, values in DNA-Sequence.items():
        if k in values:
          print(lookup_dict[k], end=" ")
          break
      else: #if the length of inputDNA is not a multiple of 3
        print("I hate u")
  </code></pre>
  
  <p>What happened:</p>
  
  <pre><code>Enter your DNA sequence: CCATAGCACGTT
  Your DNA sequence is: CCATAGCACGTT
  GGUAUGGUGGAA
  Proline I hate u
  Histidine I hate u
  </code></pre>
  
  <p>What I want to happen:</p>
  
  <pre><code>Enter your DNA sequence: CCATAGCACGTT
  Your DNA sequence is: CCATAGCACGTT #this is because I need to convert DNA sequence to RNA but I am not sure of the formula and how to do it in python
  GGUAUCGUGCAA
  Your amino acids chain is: Glycine, Isoleucine, Valine, Glutamine
  </code></pre>
  
  <p>Why do I get the output of <code>A</code>, and how do I fix it to become the output I want? I know that I am not doing <code>RNA = RNA.replace('G', 'C')</code> but when I do that, the output becomes</p>
  
  <pre><code>Enter your DNA sequence: CAACAUGCU
  Your DNA sequence is CAACAUGCU
  A
  Glutamine Histidine Alanine 
  </code></pre>
  
  <p>Or something along those lines, but definitely <strong>not</strong> what I what do happen. Please help?</p>