Please import stdio and sys in your Python program, it is used to take inputs as
ID: 3817016 • Letter: P
Question
Please import stdio and sys in your Python program, it is used to take inputs as well as print. Thank you in advance!
Problem 1 (Watson-Crick Complement) Implement the function wc-complemento in wc-complement .py that takes a DNA string as argument and returns its Watson-Crick complement replace A with T, C with G, and vice versa. You may assume that the characters in the DNA string are all in upper case. python WC complement py ACTGACG TGA CTG C import stdio import sys Returns the Watson-Crick complement of the given DNA string def wc complement (dna) s the wc complement of dna for c in dna return s Test client DO NOT EDIT Reads a DNA string as command-line argument and writes its Watson-Crick complement. def main dna sys.argv [1] stdio.writeln (wc ment (dna.upper if name main mainExplanation / Answer
python 2.7 code:
def wc_complement(s):
comp = "";
for c in s:
if(c == "A"):
comp = comp + "T";
elif(c == "T"):
comp = comp + "A";
elif(c == "G"):
comp = comp + "C";
elif(c == "C"):
comp = comp + "G";
return comp
def _main():
print "Enter the DNA Sequence!"
s = raw_input().strip()
comp = wc_complement(s)
print "Complement is :", comp
if __name__ == '__main__':
_main()
Sample Output:
Enter the DNA Sequence!
ACTGACG
Complement is : TGACTGC