a program to change letters in DNA nucleotide
I'm making a program to change the sequence of DNA. When finding the letter "a", replace it with a "t", and opposite. But I've encountered a problem cause when the program runs, it replaces "a" with "t", then replaces "t" with "a" again.
How can I fix that?
The code:
def opposite_nucleotide(dna):
dna = dna.replace("a", "t")
dna = dna.replace("t", "a")
dna = dna.replace("g", "c")
dna = dna.replace("c", "g")
return dna
dna3 = input("Enter the DNA to represent it's oppsite one: ")
dna4 = opposite_nucleotide(dna3)
print(dna4)
from Recent Questions - Stack Overflow https://ift.tt/2ObEJGf
https://ift.tt/eA8V8J
Comments
Post a Comment