Last active
August 29, 2015 14:02
-
-
Save stepjue/ccaef56d5aa5df51c1e1 to your computer and use it in GitHub Desktop.
Solution for Rosalind's "hamm" problem (http://rosalind.info/problems/hamm/). Finds the Hamming distance of two DNA strings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def hamming_distance(s,t): | |
| dist = 0 | |
| for i in range(s): | |
| if(s[i] != t[i]): | |
| dist++ | |
| return dist | |
| if __name__ == "__main__": | |
| lines = [] | |
| for line in open("rosalind_hamm.txt"): | |
| lines.append(line) | |
| s = lines[0] | |
| t = lines[1] | |
| dist = hamming_distance(s,t) | |
| print(dist) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment