Home /
Expert Answers /
Computer Science /
hamming-distance-between-two-strings-of-equal-length-is-the-number-of-positions-at-which-the-corres-pa942
(Solved): Hamming distance between two strings of equal length is the number of positions at which the corres ...
Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number of substitutions required to change one string into the other, or the minimum number of errors that could have transformed one string into the other. For example, hamming distance between "car" and "fat" is 2. Write a Python program that accepts a DNA sequence from a text file 'dna.txt' and a given pattern P and a hamming distance value. The program finds how many times the pattern P occurs in the DNA within the given hamming distance. For example: if dna.txt is 'ACCACTGTCTCTGC' and the pattern P is 'ACT' and the given hamming distance is 1 , the output of your program should be 3 .