a="AGGGCCCCACCAGTACGTCTGGCCAGGGGACTGTGTTAGTGGTGTCGACAGCCGCCACAGGCATAACGATGGATATATACTCCGATACGCATCTCGTAGATTGCCCTATAGGCAGTGGGCAATTAGTAGCGCCCAGTTTTCAAGAGACCTCACGCTCTAGCGAAGCTACGTTTGCCCCCGGGGTGTAAGGGGGCTAAGGTCTACCCGGATCGCGAGGTGGAAGGCCTAAGTAGATCGAATGGTATAAAGGACATCGCATAATAACGTGGAGTGGATCCATCGCACATTACCATTCTGATTACAGTTTTTAATGAATCAATGTTCGGGTTGACCGGGACAAAAATACATGCAGACGATGATAACGCAACTAAATTAACCCCGTTGCAACCTGGTCGCTAGATGACTCCTTTTGATACGAATGCCATTAGTAACGTCATCCTGCGCCGAAGGAGTATTTAATGCAATCCGATACTGGTGAGGGTCCAGAAATTCAGCTTCCGATAGAGCACCCGGGTGATCGTCCTACGTTTGTGGATTTGTCGTTGCTGCCGCTTTTAATACGCTTTTCGGAGTATTCAAGAGCCATCGAGGTGTAGGTCCCTTCGATGTCATTTCTATGGACCGAGCGTGGAGGACCACGCGACCGCCAATATTTCCTTTTCCTTAGAGGACACAAGTAGGCTTTAGATGCGACCAACAAGAAGACGAGTGGGTGACCTAGTGCCCATGCCACATCGATGGGGCAAGGCTTTATGATTAATGACCAAGGGGACTGTTGGTGTTGCTACATCGATCAATGTCTGTCTCAATAGCATAGTCGGACGGCGTGTCGTAAGCAAGCTTTATCTATATTGAGAGACGGGCACATAACGGAAAGCACGCCCGTCGTCTGGTCCACCTCTCTTTA"
a= a.translate({ord('A'):'T',ord('T'):'A',ord('G'):'C',ord('C'):'G'})
a= a[::-1]
print(a)

In DNA stringssymbols 'A' and 'T' are complements of each other, as are 'C' and 'G'.

The reverse complement of a DNA string s is the string sc formed by reversing the symbols of s, then taking the complement of each symbol (e.g., the reverse complement of "GTCA" is "TGAC").

Given: A DNA string s of length at most 1000 bp.

Return: The reverse complement sc of s.

'Python > rosaland' 카테고리의 다른 글

Counting Point Mutations  (0) 2018.11.21
Computing GC Content  (0) 2018.11.21
Rabbits and Recurrence Relations  (0) 2018.11.16
Transcribing DNA into RNA  (0) 2018.11.14
Counting DNA Nucleotides  (0) 2018.11.14

+ Recent posts