Given: Two DNA strings s and t of equal length (not exceeding 1 kbp).
Return: The Hamming distance dH(s,t).
import sys
def main():
if len(sys.argv) > 1:
s1 = sys.argv[1]
s2 = sys.argv[2]
diff_counter = 0
i = 0
while i < len(s1):
if s1[i] != s2[i]:
diff_counter += 1
i += 1
print diff_counter
else:
print 'Enter 2 strings.'
if __name__ == '__main__':
main()
Return: The Hamming distance dH(s,t).
import sys
def main():
if len(sys.argv) > 1:
s1 = sys.argv[1]
s2 = sys.argv[2]
diff_counter = 0
i = 0
while i < len(s1):
if s1[i] != s2[i]:
diff_counter += 1
i += 1
print diff_counter
else:
print 'Enter 2 strings.'
if __name__ == '__main__':
main()
Комментариев нет:
Отправить комментарий