I have a function in python where I want the reverse complement of a DNA string.
This is what I have now:
def inversComplement(input): output = '' for letter in input: letter = letter.upper() if letter == 'A': output += 'T' elif letter == 'T': output += 'A' elif letter == 'G': output += 'C' else: output += 'G' return(output[::-1])
I was thinking of using the string.replace() method. But the problem was that if I use this the T-> A would be changed afterwards with the A -> T replacement