def reverse_compliment(dna): compliment = str.maketrans('ATGC', 'TACG') return ''.join(reversed(dna.upper().translate(compliment)))
- def reverse_compliment(dna):
DNA,rdna= dna.upper(),''gen={'A':'T','T':'A','G':'C','C':'G'}for i in DNA: rdna=gen[i]+rdnareturn rdna- compliment = str.maketrans('ATGC', 'TACG')
- return ''.join(reversed(dna.upper().translate(compliment)))