Ad
Code
Diff
  • def reverse_compliment(dna):
        DNA,rdna= dna.upper(),''
        gen={'A':'T','T':'A','G':'C','C':'G'}
        for i in DNA: rdna=gen[i]+rdna
        return rdna 
    • def reverse_compliment(dna):
    • DNA = dna.upper()
    • rcom = []
    • for i in dna:
    • if i == 'A':
    • rcom.append('T')
    • elif i == 'T':
    • rcom.append('A')
    • elif i == 'G':
    • rcom.append('C')
    • elif i == 'C':
    • rcom.append('G')
    • r = rcom[::-1]
    • reversedna = ''.join(r)
    • return reversedna
    • DNA,rdna= dna.upper(),''
    • gen={'A':'T','T':'A','G':'C','C':'G'}
    • for i in DNA: rdna=gen[i]+rdna
    • return rdna