Page 1

Student ID: 158, P-Value: 9.66e-09

Nearest Neighbor ID: 79

Student (left) and Nearest Neighbor (right).


t1import matht1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
28    nRemainder = nBoard  28    nRemainder = nBoard  
29    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3**digit))32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
34    return boardList34    return boardList
35def countBases(seq):35def countBases(seq):
36    bases = ['A','C','G','T']36    bases = ['A','C','G','T']
37    counts = []37    counts = []
38    for base in bases:38    for base in bases:
39        count = 039        count = 0
40        for char in seq:40        for char in seq:
41            if(base == char):41            if(base == char):
42                count += 142                count += 1
43        counts.append(count)43        counts.append(count)
44    A = counts[0]44    A = counts[0]
45    C = counts[1]45    C = counts[1]
46    G = counts[2]46    G = counts[2]
47    T = counts[3]47    T = counts[3]
48    cg_percentage = (C+G)*100 / len(seq)48    cg_percentage = (C+G)*100 / len(seq)
49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'
51countBases(seq)51countBases(seq)
52def hammingdistance(seq_a, seq_b):52def hammingdistance(seq_a, seq_b):
53    if(len(seq_a) != len(seq_b)):53    if(len(seq_a) != len(seq_b)):
54        return "Error: Sequences Length Mismatch"54        return "Error: Sequences Length Mismatch"
55    else:55    else:
56        count = 056        count = 0
57        for char1,char2 in zip(seq_a,seq_b):57        for char1,char2 in zip(seq_a,seq_b):
58            if(char1 != char2):58            if(char1 != char2):
59                count += 159                count += 1
60    return(count)60    return(count)
61seq_a = 'GATATCGTCTGGGACCT'61seq_a = 'GATATCGTCTGGGACCT'
62seq_b = 'CATCGCATTTACGGCCT'62seq_b = 'CATCGCATTTACGGCCT'
63hammingdistance(seq_a, seq_b)63hammingdistance(seq_a, seq_b)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 2

Student ID: 79, P-Value: 9.66e-09

Nearest Neighbor ID: 158

Student (left) and Nearest Neighbor (right).


t1import matht1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
28    nRemainder = nBoard  28    nRemainder = nBoard  
29    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3**digit))32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
34    return boardList34    return boardList
35def countBases(seq):35def countBases(seq):
36    bases = ['A','C','G','T']36    bases = ['A','C','G','T']
37    counts = []37    counts = []
38    for base in bases:38    for base in bases:
39        count = 039        count = 0
40        for char in seq:40        for char in seq:
41            if(base == char):41            if(base == char):
42                count += 142                count += 1
43        counts.append(count)43        counts.append(count)
44    A = counts[0]44    A = counts[0]
45    C = counts[1]45    C = counts[1]
46    G = counts[2]46    G = counts[2]
47    T = counts[3]47    T = counts[3]
48    cg_percentage = (C+G)*100 / len(seq)48    cg_percentage = (C+G)*100 / len(seq)
49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'
51countBases(seq)51countBases(seq)
52def hammingdistance(seq_a, seq_b):52def hammingdistance(seq_a, seq_b):
53    if(len(seq_a) != len(seq_b)):53    if(len(seq_a) != len(seq_b)):
54        return "Error: Sequences Length Mismatch"54        return "Error: Sequences Length Mismatch"
55    else:55    else:
56        count = 056        count = 0
57        for char1,char2 in zip(seq_a,seq_b):57        for char1,char2 in zip(seq_a,seq_b):
58            if(char1 != char2):58            if(char1 != char2):
59                count += 159                count += 1
60    return(count)60    return(count)
61seq_a = 'GATATCGTCTGGGACCT'61seq_a = 'GATATCGTCTGGGACCT'
62seq_b = 'CATCGCATTTACGGCCT'62seq_b = 'CATCGCATTTACGGCCT'
63hammingdistance(seq_a, seq_b)63hammingdistance(seq_a, seq_b)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 3

Student ID: 215, P-Value: 2.29e-08

Nearest Neighbor ID: 478

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
28    nRemainder = nBoard  28    nRemainder = nBoard  
29    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3**digit))32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
n34    return boardListdef countBases(seq):n34    return boardListdef  countBases(seq):
35    A = str(seq).count('A')35    A = str(seq).count('A')
36    T = str(seq).count('T')36    T = str(seq).count('T')
37    C = str(seq).count('C')37    C = str(seq).count('C')
38    G = str(seq).count('G')38    G = str(seq).count('G')
t39    cg_percentage = (C/ len(str(seq)))*100 + (G/ len(str(seq)))*100t39    cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100)
40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
41def hammingdistance(seq_a, seq_b):41def hammingdistance(seq_a, seq_b):
42    s= seq_a42    s= seq_a
43    t= seq_b43    t= seq_b
44    count=044    count=0
45    for i in range(len(s)):45    for i in range(len(s)):
46        if s[i]!= t[i]:46        if s[i]!= t[i]:
47            count+=147            count+=1
48    if len(seq_a) != len(seq_b):48    if len(seq_a) != len(seq_b):
49        return "Error: Sequences Length Mismatch"49        return "Error: Sequences Length Mismatch"
50    else:50    else:
51        return count51        return count
52    if __name__=="__main__":52    if __name__=="__main__":
53        pass53        pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 4

Student ID: 478, P-Value: 2.29e-08

Nearest Neighbor ID: 215

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
28    nRemainder = nBoard  28    nRemainder = nBoard  
29    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3**digit))32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
n34    return boardListdef  countBases(seq):n34    return boardListdef countBases(seq):
35    A = str(seq).count('A')35    A = str(seq).count('A')
36    T = str(seq).count('T')36    T = str(seq).count('T')
37    C = str(seq).count('C')37    C = str(seq).count('C')
38    G = str(seq).count('G')38    G = str(seq).count('G')
t39    cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100)t39    cg_percentage = (C/ len(str(seq)))*100 + (G/ len(str(seq)))*100
40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
41def hammingdistance(seq_a, seq_b):41def hammingdistance(seq_a, seq_b):
42    s= seq_a42    s= seq_a
43    t= seq_b43    t= seq_b
44    count=044    count=0
45    for i in range(len(s)):45    for i in range(len(s)):
46        if s[i]!= t[i]:46        if s[i]!= t[i]:
47            count+=147            count+=1
48    if len(seq_a) != len(seq_b):48    if len(seq_a) != len(seq_b):
49        return "Error: Sequences Length Mismatch"49        return "Error: Sequences Length Mismatch"
50    else:50    else:
51        return count51        return count
52    if __name__=="__main__":52    if __name__=="__main__":
53        pass53        pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 5

Student ID: 354, P-Value: 7.11e-08

Nearest Neighbor ID: 79

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
t28    nRemainder = nBoardt28    nRemainder = nBoard  
29    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3**digit))32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
34    return boardList34    return boardList
35def countBases(seq):35def countBases(seq):
36    bases = ['A','C','G','T']36    bases = ['A','C','G','T']
37    counts = []37    counts = []
38    for base in bases:38    for base in bases:
39        count = 039        count = 0
40        for char in seq:40        for char in seq:
41            if(base == char):41            if(base == char):
42                count += 142                count += 1
43        counts.append(count)43        counts.append(count)
44    A = counts[0]44    A = counts[0]
45    C = counts[1]45    C = counts[1]
46    G = counts[2]46    G = counts[2]
47    T = counts[3]47    T = counts[3]
48    cg_percentage = (C+G)*100 / len(seq)48    cg_percentage = (C+G)*100 / len(seq)
49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'
51countBases(seq)51countBases(seq)
52def hammingdistance(seq_a, seq_b):52def hammingdistance(seq_a, seq_b):
53    if(len(seq_a) != len(seq_b)):53    if(len(seq_a) != len(seq_b)):
54        return "Error: Sequences Length Mismatch"54        return "Error: Sequences Length Mismatch"
55    else:55    else:
56        count = 056        count = 0
57        for char1,char2 in zip(seq_a,seq_b):57        for char1,char2 in zip(seq_a,seq_b):
58            if(char1 != char2):58            if(char1 != char2):
59                count += 159                count += 1
60    return(count)60    return(count)
61seq_a = 'GATATCGTCTGGGACCT'61seq_a = 'GATATCGTCTGGGACCT'
62seq_b = 'CATCGCATTTACGGCCT'62seq_b = 'CATCGCATTTACGGCCT'
63hammingdistance(seq_a, seq_b)63hammingdistance(seq_a, seq_b)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 6

Student ID: 37, P-Value: 8.31e-08

Nearest Neighbor ID: 478

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
28    nRemainder = nBoard  28    nRemainder = nBoard  
29    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3**digit))32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
34    return boardListdef  countBases(seq):34    return boardListdef  countBases(seq):
35    A = str(seq).count('A')35    A = str(seq).count('A')
36    T = str(seq).count('T')36    T = str(seq).count('T')
37    C = str(seq).count('C')37    C = str(seq).count('C')
38    G = str(seq).count('G')38    G = str(seq).count('G')
39    cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100)39    cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100)
40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
41def hammingdistance(seq_a, seq_b):41def hammingdistance(seq_a, seq_b):
42    s= seq_a42    s= seq_a
43    t= seq_b43    t= seq_b
44    count=044    count=0
45    for i in range(len(s)):45    for i in range(len(s)):
46        if s[i]!= t[i]:46        if s[i]!= t[i]:
47            count+=147            count+=1
48    if len(seq_a) != len(seq_b):48    if len(seq_a) != len(seq_b):
49        return "Error: Sequences Length Mismatch"49        return "Error: Sequences Length Mismatch"
50    else:50    else:
51        return count51        return count
tt52    if __name__=="__main__":
53        pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 7

Student ID: 395, P-Value: 1.22e-07

Nearest Neighbor ID: 79

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
28    nRemainder = nBoard  28    nRemainder = nBoard  
29    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3**digit))32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
t34    return boardListdef countBases(seq):t34    return boardList
35def countBases(seq):
35    bases = ['A','C','G','T']36    bases = ['A','C','G','T']
36    counts = []37    counts = []
37    for base in bases:38    for base in bases:
38        count = 039        count = 0
39        for char in seq:40        for char in seq:
40            if(base == char):41            if(base == char):
41                count += 142                count += 1
42        counts.append(count)43        counts.append(count)
43    A = counts[0]44    A = counts[0]
44    C = counts[1]45    C = counts[1]
45    G = counts[2]46    G = counts[2]
46    T = counts[3]47    T = counts[3]
47    cg_percentage = (C+G)*100 / len(seq)48    cg_percentage = (C+G)*100 / len(seq)
48    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
49seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'
50countBases(seq)51countBases(seq)
51def hammingdistance(seq_a, seq_b):52def hammingdistance(seq_a, seq_b):
52    if(len(seq_a) != len(seq_b)):53    if(len(seq_a) != len(seq_b)):
53        return "Error: Sequences Length Mismatch"54        return "Error: Sequences Length Mismatch"
54    else:55    else:
55        count = 056        count = 0
56        for char1,char2 in zip(seq_a,seq_b):57        for char1,char2 in zip(seq_a,seq_b):
57            if(char1 != char2):58            if(char1 != char2):
58                count += 159                count += 1
59    return(count)60    return(count)
60seq_a = 'GATATCGTCTGGGACCT'61seq_a = 'GATATCGTCTGGGACCT'
61seq_b = 'CATCGCATTTACGGCCT'62seq_b = 'CATCGCATTTACGGCCT'
62hammingdistance(seq_a, seq_b)63hammingdistance(seq_a, seq_b)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 8

Student ID: 98, P-Value: 2.01e-06

Nearest Neighbor ID: 37

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
28    nRemainder = nBoard  28    nRemainder = nBoard  
29    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3**digit))32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
n34    return boardListdef countBases(seq):n34    return boardListdef  countBases(seq):
35    A = str(seq).count('A')35    A = str(seq).count('A')
36    T = str(seq).count('T')36    T = str(seq).count('T')
37    C = str(seq).count('C')37    C = str(seq).count('C')
38    G = str(seq).count('G')38    G = str(seq).count('G')
n39    cg_percentage = (C / len(str(seq)))*100 + (G / len(str(seq)))*100n39    cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100)
40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
41def hammingdistance(seq_a, seq_b):41def hammingdistance(seq_a, seq_b):
n42    a= seq_an42    s= seq_a
43    b= seq_b43    t= seq_b
44    count=044    count=0
n45    for i in range(len(a)):n45    for i in range(len(s)):
46        if a[i]!= b[i]:46        if s[i]!= t[i]:
47            count+=1   47            count+=1
48    if len(seq_a) != len(seq_b):48    if len(seq_a) != len(seq_b):
49        return "Error: Sequences Length Mismatch"49        return "Error: Sequences Length Mismatch"
50    else:50    else:
51        return count51        return count
t52    passt
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 9

Student ID: 11, P-Value: 1.92e-05

Nearest Neighbor ID: 79

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
28    nRemainder = nBoard  28    nRemainder = nBoard  
29    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3**digit))32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
34    return boardList34    return boardList
t35t = decodeBoard(2291)t35def countBases(seq):
36print(t)
37print(findWinner(t))
38print()
39t = decodeBoard(1851)
40print(t)
41print(findWinner(t))def countBases(seq):
42    bases = ['A','C','G','T']36    bases = ['A','C','G','T']
43    counts = []37    counts = []
44    for base in bases:38    for base in bases:
45        count = 039        count = 0
46        for char in seq:40        for char in seq:
47            if(base == char):41            if(base == char):
48                count += 142                count += 1
49        counts.append(count)43        counts.append(count)
50    A = counts[0]44    A = counts[0]
51    C = counts[1]45    C = counts[1]
52    G = counts[2]46    G = counts[2]
53    T = counts[3]47    T = counts[3]
54    cg_percentage = (C+G)*100 / len(seq)48    cg_percentage = (C+G)*100 / len(seq)
55    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
56seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'
57countBases(seq)51countBases(seq)
58def hammingdistance(seq_a, seq_b):52def hammingdistance(seq_a, seq_b):
59    if(len(seq_a) != len(seq_b)):53    if(len(seq_a) != len(seq_b)):
60        return "Error: Sequences Length Mismatch"54        return "Error: Sequences Length Mismatch"
61    else:55    else:
62        count = 056        count = 0
63        for char1,char2 in zip(seq_a,seq_b):57        for char1,char2 in zip(seq_a,seq_b):
64            if(char1 != char2):58            if(char1 != char2):
65                count += 159                count += 1
66    return(count)60    return(count)
67seq_a = 'GATATCGTCTGGGACCT'61seq_a = 'GATATCGTCTGGGACCT'
68seq_b = 'CATCGCATTTACGGCCT'62seq_b = 'CATCGCATTTACGGCCT'
69hammingdistance(seq_a, seq_b)63hammingdistance(seq_a, seq_b)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 10

Student ID: 74, P-Value: 7.06e-05

Nearest Neighbor ID: 79

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
28    nRemainder = nBoard  28    nRemainder = nBoard  
29    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3**digit))32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
34    return boardList34    return boardList
35def countBases(seq):35def countBases(seq):
36    bases = ['A','C','G','T']36    bases = ['A','C','G','T']
37    counts = []37    counts = []
38    for base in bases:38    for base in bases:
39        count = 039        count = 0
40        for char in seq:40        for char in seq:
41            if(base == char):41            if(base == char):
42                count += 142                count += 1
43        counts.append(count)43        counts.append(count)
44    A = counts[0]44    A = counts[0]
45    C = counts[1]45    C = counts[1]
46    G = counts[2]46    G = counts[2]
47    T = counts[3]47    T = counts[3]
n48    cg = (C+G)*100 / len(seq)n48    cg_percentage = (C+G)*100 / len(seq)
49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg)49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'
51countBases(seq)51countBases(seq)
n52def hammingdistance(seqa, seqb):n52def hammingdistance(seq_a, seq_b):
53    if(len(seqa) != len(seqb)):53    if(len(seq_a) != len(seq_b)):
54        return "Error: Sequences Length Mismatch"54        return "Error: Sequences Length Mismatch"
55    else:55    else:
56        count = 056        count = 0
n57        for c1,c2 in zip(seqa,seqb):n57        for char1,char2 in zip(seq_a,seq_b):
58            if(c1 != c2):58            if(char1 != char2):
59                count += 159                count += 1
60    return(count)60    return(count)
t61seqa = 'GATATCGTCTGGGACCT't61seq_a = 'GATATCGTCTGGGACCT'
62seqb = 'CATCGCATTTACGGCCT'62seq_b = 'CATCGCATTTACGGCCT'
63hammingdistance(seqa, seqb)63hammingdistance(seq_a, seq_b)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 11

Student ID: 295, P-Value: 7.13e-04

Nearest Neighbor ID: 11

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
nn20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:
22            return 'X'
23        elif boardList[2] == 2:
24            return 'O'
20    return '-'25    return '-'
21def decodeBoard(nBoard):26def decodeBoard(nBoard):
n22    boardList=[]n27    boardList = []
23    nRemainder=nBoard 28    nRemainder = nBoard  
24    for digit in range(8,-1,-1): 29    for digit in range(8, -1, -1):
25        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
26        x = math.floor(x)31        x = math.floor(x)
n27        nRemainder = nRemainder - ( x * (3**digit) )n32        nRemainder = nRemainder - (x * (3**digit))
28        boardList.append(x)      33        boardList.append(x)
29    return boardList34    return boardList
30t = decodeBoard(2291)35t = decodeBoard(2291)
31print(t)36print(t)
32print(findWinner(t))37print(findWinner(t))
33print()38print()
34t = decodeBoard(1851)39t = decodeBoard(1851)
35print(t)40print(t)
36print(findWinner(t))def countBases(seq):41print(findWinner(t))def countBases(seq):
37    bases = ['A','C','G','T']42    bases = ['A','C','G','T']
38    counts = []43    counts = []
39    for base in bases:44    for base in bases:
40        count = 045        count = 0
41        for char in seq:46        for char in seq:
42            if(base == char):47            if(base == char):
n43                count +=1n48                count += 1
44        counts.append(count)49        counts.append(count)
45    A = counts[0]50    A = counts[0]
46    C = counts[1]51    C = counts[1]
47    G = counts[2]52    G = counts[2]
48    T = counts[3]53    T = counts[3]
49    cg_percentage = (C+G)*100 / len(seq)54    cg_percentage = (C+G)*100 / len(seq)
50    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)55    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
51seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'56seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'
n52print (countBases(seq))n57countBases(seq)
53def hammingdistance(seq_a, seq_b):58def hammingdistance(seq_a, seq_b):
54    if(len(seq_a) != len(seq_b)):59    if(len(seq_a) != len(seq_b)):
n55        return "Error: Sequence Length Mismatch"n60        return "Error: Sequences Length Mismatch"
56    else:61    else:
57        count = 062        count = 0
58        for char1,char2 in zip(seq_a,seq_b):63        for char1,char2 in zip(seq_a,seq_b):
59            if(char1 != char2):64            if(char1 != char2):
60                count += 165                count += 1
61    return(count)66    return(count)
62seq_a = 'GATATCGTCTGGGACCT'67seq_a = 'GATATCGTCTGGGACCT'
63seq_b = 'CATCGCATTTACGGCCT'68seq_b = 'CATCGCATTTACGGCCT'
t64print (hammingdistance(seq_a, seq_b))t69hammingdistance(seq_a, seq_b)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 12

Student ID: 347, P-Value: 7.64e-04

Nearest Neighbor ID: 273

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
n3    if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[2:9:3n3    if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[1:8:3
>]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardList[3:6:1]==[1,1,1] or boardLis>]==[1,1,1] or boardList[2:9:3]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardLis
>t[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or boardList[2:7:2]==[1,1,1]:>t[3:6:1]==[1,1,1] or boardList[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or b
 >oardList[2:7:2]==[1,1,1]:
4        return 'X'4        return 'X' 
5    elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[2:95    elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[1:8
>:3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardList[3:6:1]==[2,2,2] or boardL>:3]==[2,2,2] or boardList[2:9:3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardL
>ist[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or boardList[2:7:2]==[2,2,2]:>ist[3:6:1]==[2,2,2] or boardList[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or
 > boardList[2:7:2]==[2,2,2]:
6        return 'O'6        return 'O'
n7    else:n7    else: 
8        return '-'8        return '-'
nn9    pass
9def decodeBoard(nBoard):10def decodeBoard(nBoard):
10    boardList=[]11    boardList=[]
11    nRemainder=int(nBoard) 12    nRemainder=int(nBoard) 
12    for digit in range(8,-1,-1): 13    for digit in range(8,-1,-1): 
13        x = nRemainder / (3**digit)14        x = nRemainder / (3**digit)
14        x = math.floor(x)15        x = math.floor(x)
15        nRemainder = nRemainder - ( x * (3**digit) )16        nRemainder = nRemainder - ( x * (3**digit) )
n16        boardList.append(x)     n17        boardList.append(x)   
17    return boardList18    return boardList
18if __name__=="__main__":19if __name__=="__main__":
n19    passn
20def countBases(seq):20    passdef countBases(seq):
21    A=021    A = 0
22    C=022    C = 0
23    G=023    G = 0
24    T=024    T = 0 
25    for n in range(0,len(seq)):25    for n in range(0,len(seq)):
26        if seq[n]=='A':26        if seq[n]=='A':
n27            A+=1n27            A = A+1
28        elif seq[n]=='C':28        elif seq[n]=='C':
n29            C+=1n29            C = C+1
30        elif seq[n]=='G':30        elif seq[n]=='G':
n31            G+=1n31            G = G+1
32        elif seq[n]=='T':32        elif seq[n]=='T':
n33            T+=1n33            T = T+1
34    cg_percentage = 100*((C+G)/(len(seq))) 34    cg_percentage = 100*((C+G)/(len(seq))) 
35    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)35    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
36def hammingdistance(seq_a, seq_b):36def hammingdistance(seq_a, seq_b):
37    if len(seq_a)==len(seq_b):37    if len(seq_a)==len(seq_b):
38        count = -138        count = -1
39        for i in range(0,len(seq_a)):39        for i in range(0,len(seq_a)):
40            if seq_a[i]==seq_b[i]:40            if seq_a[i]==seq_b[i]:
n41                count+=1n41                count = count+1
42        return count42        return count
43    else:43    else:
44        return 'Error: Sequences Length Mismatch'44        return 'Error: Sequences Length Mismatch'
tt45if __name__=="__main__":
46    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 13

Student ID: 273, P-Value: 7.64e-04

Nearest Neighbor ID: 347

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
n3    if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[1:8:3n3    if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[2:9:3
>]==[1,1,1] or boardList[2:9:3]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardLis>]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardList[3:6:1]==[1,1,1] or boardLis
>t[3:6:1]==[1,1,1] or boardList[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or b>t[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or boardList[2:7:2]==[1,1,1]:
>oardList[2:7:2]==[1,1,1]: 
4        return 'X' 4        return 'X'
5    elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[1:85    elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[2:9
>:3]==[2,2,2] or boardList[2:9:3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardL>:3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardList[3:6:1]==[2,2,2] or boardL
>ist[3:6:1]==[2,2,2] or boardList[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or>ist[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or boardList[2:7:2]==[2,2,2]:
> boardList[2:7:2]==[2,2,2]: 
6        return 'O'6        return 'O'
n7    else: n7    else:
8        return '-'8        return '-'
n9    passn
10def decodeBoard(nBoard):9def decodeBoard(nBoard):
11    boardList=[]10    boardList=[]
12    nRemainder=int(nBoard) 11    nRemainder=int(nBoard) 
13    for digit in range(8,-1,-1): 12    for digit in range(8,-1,-1): 
14        x = nRemainder / (3**digit)13        x = nRemainder / (3**digit)
15        x = math.floor(x)14        x = math.floor(x)
16        nRemainder = nRemainder - ( x * (3**digit) )15        nRemainder = nRemainder - ( x * (3**digit) )
n17        boardList.append(x)   n16        boardList.append(x)     
18    return boardList17    return boardList
19if __name__=="__main__":18if __name__=="__main__":
nn19    pass
20    passdef countBases(seq):20def countBases(seq):
21    A = 021    A=0
22    C = 022    C=0
23    G = 023    G=0
24    T = 0 24    T=0
25    for n in range(0,len(seq)):25    for n in range(0,len(seq)):
26        if seq[n]=='A':26        if seq[n]=='A':
n27            A = A+1n27            A+=1
28        elif seq[n]=='C':28        elif seq[n]=='C':
n29            C = C+1n29            C+=1
30        elif seq[n]=='G':30        elif seq[n]=='G':
n31            G = G+1n31            G+=1
32        elif seq[n]=='T':32        elif seq[n]=='T':
n33            T = T+1n33            T+=1
34    cg_percentage = 100*((C+G)/(len(seq))) 34    cg_percentage = 100*((C+G)/(len(seq))) 
35    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)35    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
36def hammingdistance(seq_a, seq_b):36def hammingdistance(seq_a, seq_b):
37    if len(seq_a)==len(seq_b):37    if len(seq_a)==len(seq_b):
38        count = -138        count = -1
39        for i in range(0,len(seq_a)):39        for i in range(0,len(seq_a)):
40            if seq_a[i]==seq_b[i]:40            if seq_a[i]==seq_b[i]:
n41                count = count+1n41                count+=1
42        return count42        return count
43    else:43    else:
44        return 'Error: Sequences Length Mismatch'44        return 'Error: Sequences Length Mismatch'
t45if __name__=="__main__":t
46    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 14

Student ID: 34, P-Value: 1.00e-03

Nearest Neighbor ID: 478

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
n9    for column in range(3):n9    for col in range(3):
10        if boardList[column] == boardList[column+3] == boardList[column+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[column] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
n13            elif boardList[column] == 2:n13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
n27    boardList=[]n27    boardList = []
28    nRemainder=nBoard 28    nRemainder = nBoard  
29    for digit in range(8, -1, -1): 29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
n32        nRemainder = nRemainder - ( x * (3**digit) )n32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
n34    return boardListn
35if __name__=="__main__":
36    passdef  countBases(seq):34    return boardListdef  countBases(seq):
37    A = str(seq).count('A')35    A = str(seq).count('A')
nn36    T = str(seq).count('T')
38    C = str(seq).count('C')37    C = str(seq).count('C')
39    G = str(seq).count('G')38    G = str(seq).count('G')
n40    T = str(seq).count('T')n
41    cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100)39    cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100)
42    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
43def hammingdistance(seq_a, seq_b):41def hammingdistance(seq_a, seq_b):
nn42    s= seq_a
44    t= seq_b43    t= seq_b
n45    s= seq_an
46    count=044    count=0
n47    for j in range(len(s)):n45    for i in range(len(s)):
48        if s[j]!= t[j]:46        if s[i]!= t[i]:
49            count+=147            count+=1
n50    if len(seq_b) != len(seq_a):n48    if len(seq_a) != len(seq_b):
51        return "Error: Sequences Length Mismatch"49        return "Error: Sequences Length Mismatch"
52    else:50    else:
53        return count51        return count
tt52    if __name__=="__main__":
53        pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 15

Student ID: 495, P-Value: 1.68e-03

Nearest Neighbor ID: 318

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
n14                return '0'n14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
n19            return '0'n19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
n24            return '0'    n24            return 'O'
25    else:
25    return '-'26        return '-'
27    pass
26def decodeBoard(nBoard):28def decodeBoard(nBoard):
27    boardList = []29    boardList = []
n28    nRemainder = nBoard n30    nRemainder = nBoard
29    for digit in range(8, -1, -1):31    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)32        x = nRemainder / (3**digit)
31        x = math.floor(x)33        x = math.floor(x)
n32        nRemainder = nRemainder - (x * (3**digit))n34        nRemainder = nRemainder - ( x * (3**digit) )
33        boardList.append(x)35        boardList.append(x)
34    return boardList36    return boardList
n35t = decodeBoard(2291)n37if __name__ =="__main__":
36print(t)38    pass
37print(findWinner(t))39def countBases(seq):
38print()
39t = decodeBoard(1851)
40print(t)
41print(findWinner(t))def countBases(seq):
42    a = 040    a = 0
43    t = 041    t = 0
44    c = 042    c = 0
45    g = 043    g = 0
n46    for n in seq: n44    for n in seq:
47        if n == 'A':45        if n == 'A':
n48           a += 1n46            a += 1
49        elif n == 'T':47        elif n == 'T':
50            t += 148            t += 1
51        elif n == 'C':49        elif n == 'C':
52            c += 150            c += 1
53        elif n == 'G':51        elif n == 'G':
54            g += 152            g += 1
55        Total_Percent=((c+g)/len(seq)) * 10053        Total_Percent=((c+g)/len(seq)) * 100
t56    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(a, c, g, t, Total_Percent)  t54    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(a, c, g, t, Total_Percent)
57def hammingdistance(seq_a, seq_b):55def hammingdistance(seq_a, seq_b):
58    count = 056    count = 0
59    if len(seq_a) != len(seq_b):57    if len(seq_a) != len(seq_b):
60        return "Error: Sequences Length Mismatch"58        return "Error: Sequences Length Mismatch"
61    else:59    else:
62        for i in range(len(seq_a)):60        for i in range(len(seq_a)):
63            if seq_a[i] != seq_b[i]:61            if seq_a[i] != seq_b[i]:
64                count +=162                count +=1
65    return count63    return count
66if __name__=="__main__":64if __name__=="__main__":
67    x = input()65    x = input()
68    y = input()66    y = input()
69    print(hammingdistance(x, y))67    print(hammingdistance(x, y))
70    pass68    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 16

Student ID: 318, P-Value: 1.68e-03

Nearest Neighbor ID: 495

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
n14                return 'O'n14                return '0'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
n19            return 'O'n19            return '0'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
n24            return 'O'n24            return '0'    
25    else:
26        return '-'25    return '-'
27    pass
28def decodeBoard(nBoard):26def decodeBoard(nBoard):
29    boardList = []27    boardList = []
n30    nRemainder = nBoardn28    nRemainder = nBoard 
31    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
32        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
33        x = math.floor(x)31        x = math.floor(x)
n34        nRemainder = nRemainder - ( x * (3**digit) )n32        nRemainder = nRemainder - (x * (3**digit))
35        boardList.append(x)33        boardList.append(x)
36    return boardList34    return boardList
n37if __name__ =="__main__":n35t = decodeBoard(2291)
38    pass36print(t)
39def countBases(seq):37print(findWinner(t))
38print()
39t = decodeBoard(1851)
40print(t)
41print(findWinner(t))def countBases(seq):
40    a = 042    a = 0
41    t = 043    t = 0
42    c = 044    c = 0
43    g = 045    g = 0
n44    for n in seq:n46    for n in seq: 
45        if n == 'A':47        if n == 'A':
n46            a += 1n48           a += 1
47        elif n == 'T':49        elif n == 'T':
48            t += 150            t += 1
49        elif n == 'C':51        elif n == 'C':
50            c += 152            c += 1
51        elif n == 'G':53        elif n == 'G':
52            g += 154            g += 1
53        Total_Percent=((c+g)/len(seq)) * 10055        Total_Percent=((c+g)/len(seq)) * 100
t54    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(a, c, g, t, Total_Percent)t56    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(a, c, g, t, Total_Percent)  
55def hammingdistance(seq_a, seq_b):57def hammingdistance(seq_a, seq_b):
56    count = 058    count = 0
57    if len(seq_a) != len(seq_b):59    if len(seq_a) != len(seq_b):
58        return "Error: Sequences Length Mismatch"60        return "Error: Sequences Length Mismatch"
59    else:61    else:
60        for i in range(len(seq_a)):62        for i in range(len(seq_a)):
61            if seq_a[i] != seq_b[i]:63            if seq_a[i] != seq_b[i]:
62                count +=164                count +=1
63    return count65    return count
64if __name__=="__main__":66if __name__=="__main__":
65    x = input()67    x = input()
66    y = input()68    y = input()
67    print(hammingdistance(x, y))69    print(hammingdistance(x, y))
68    pass70    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 17

Student ID: 286, P-Value: 5.98e-03

Nearest Neighbor ID: 64

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
n3    if boardList[0] == boardList[1] == boardList[2]:       n3    if boardList[0] == boardList[1] == boardList[2]: 
4        if boardList[0] == 1:4        if boardList[0] == 1:
5            return 'X'5            return 'X'
6        if boardList[0] == 2:6        if boardList[0] == 2:
n7            return 'O'n7            return 'O' 
8    elif boardList[3] == boardList[4] == boardList[5]:8    elif boardList[3] == boardList[4] == boardList[5]:
9        if boardList[3] == 1:9        if boardList[3] == 1:
10            return 'X'10            return 'X'
11        if boardList[3] == 2:11        if boardList[3] == 2:
n12            return 'O'n12            return 'O' 
13    elif boardList[6] == boardList[7] == boardList[8]:13    elif boardList[6] == boardList[7] == boardList[8]:
14        if boardList[6] == 1:14        if boardList[6] == 1:
15            return 'X'15            return 'X'
16        if boardList[6] == 2:16        if boardList[6] == 2:
17            return 'O'17            return 'O'
n18    elif boardList[0] == boardList[3] == boardList[6]:              n18    elif boardList[0] == boardList[3] == boardList[6]:
19        if boardList[0] == 1:19        if boardList[0] == 1:
20            return 'X'20            return 'X'
21        if boardList[0] == 2:21        if boardList[0] == 2:
22            return 'O'22            return 'O'
23    elif boardList[1] == boardList[4] == boardList[7]:23    elif boardList[1] == boardList[4] == boardList[7]:
24        if boardList[1] == 1:24        if boardList[1] == 1:
25            return 'X'25            return 'X'
26        if boardList[1] == 2:26        if boardList[1] == 2:
27            return 'O'27            return 'O'
n28    elif boardList[2] == boardList[5] == boardList[8]:n28    elif boardList[2] == boardList[5] == boardList[8]: 
29        if boardList[2] == 1:29        if boardList[2] == 1:
30            return 'X'30            return 'X'
31        if boardList[2] == 2:31        if boardList[2] == 2:
32            return 'O'32            return 'O'
n33    elif boardList[0] == boardList[4] == boardList[8]:        n33    elif boardList[0] == boardList[4] == boardList[8]:
34        if boardList[0] == 1:34        if boardList[0] == 1:
35            return 'X'35            return 'X'
36        if boardList[0] == 2:36        if boardList[0] == 2:
37            return 'O'37            return 'O'
n38    elif boardList[6] == boardList[4] == boardList[2]:n38    elif boardList[2] == boardList[4] == boardList[6]:
39        if boardList[6] == 1:39        if boardList[2] == 1:
40            return 'X'40            return 'X'
n41        if boardList[6] == 2:n41        if boardList[2] == 2:
42            return 'O'42            return 'O' 
43    else:                                  43    else:
44        return '-'44        return '-'
45    pass45    pass
46def decodeBoard(nBoard):46def decodeBoard(nBoard):
47    boardList=[]47    boardList=[]
48    nRemainder=nBoard 48    nRemainder=nBoard 
n49    for digit in range(8,-1,-1): n49    for digit in range(8,-1, -1): 
50        x = nRemainder / (3**digit)50        x = nRemainder / (3**digit)
51        x = math.floor(x)51        x = math.floor(x)
52        nRemainder = nRemainder - ( x * (3**digit) )52        nRemainder = nRemainder - ( x * (3**digit) )
53        boardList.append(x)53        boardList.append(x)
54    return boardList54    return boardList
55if __name__=="__main__":55if __name__=="__main__":
nn56    pass
56    passdef countBases(seq):57def countBases(seq):
57    A = 058    A = 0
58    C = 059    C = 0
59    G = 060    G = 0
60    T = 061    T = 0
n61    for n in seq:n62    for user_number in seq:
62        if n == 'A':63        if user_number == 'A':
63            A += 164            A +=1
64        elif n == 'C':65        elif user_number == 'C':
65            C += 166            C +=1 
66        elif n == 'G':67        elif user_number == 'G':
67            G += 168            G +=1
68        elif n == 'T':69        elif user_number == 'T':
69            T += 170            T += 1
nn71        else:
72            print('Error')
70    cg_percentage = ((C+G)/len(seq)) * 10073    cg_percentage = ((C+G)/len(seq))*100
71    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)74    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
72def hammingdistance(seq_a, seq_b):75def hammingdistance(seq_a, seq_b):
nn76    h_distance = 0
73    if len(seq_a) != len(seq_b):77    if len(seq_a) != len(seq_b):
n74        return('Error: Sequences Length Mismatch')n78         return 'Error: Sequence Length Mismatch'
75    count = 0
76    for n in range(len(seq_a)):79    for user_number in range(len(seq_a)):
77        if seq_a[n] != seq_b[n]:80        if seq_a[user_number] != seq_b[user_number]:
78            count = count+181            h_distance += 1
79        else:82        else:
80            print('Error: Sequences Length Mismatch')83            print('Error: Sequences Length Mismatch')
t81    return countt84    return h_distance
82if __name__=="__main__":85if __name__=="__main__":
83    pass86    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 18

Student ID: 64, P-Value: 5.98e-03

Nearest Neighbor ID: 286

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
n3    if boardList[0] == boardList[1] == boardList[2]: n3    if boardList[0] == boardList[1] == boardList[2]:       
4        if boardList[0] == 1:4        if boardList[0] == 1:
5            return 'X'5            return 'X'
6        if boardList[0] == 2:6        if boardList[0] == 2:
n7            return 'O' n7            return 'O'
8    elif boardList[3] == boardList[4] == boardList[5]:8    elif boardList[3] == boardList[4] == boardList[5]:
9        if boardList[3] == 1:9        if boardList[3] == 1:
10            return 'X'10            return 'X'
11        if boardList[3] == 2:11        if boardList[3] == 2:
n12            return 'O' n12            return 'O'
13    elif boardList[6] == boardList[7] == boardList[8]:13    elif boardList[6] == boardList[7] == boardList[8]:
14        if boardList[6] == 1:14        if boardList[6] == 1:
15            return 'X'15            return 'X'
16        if boardList[6] == 2:16        if boardList[6] == 2:
17            return 'O'17            return 'O'
n18    elif boardList[0] == boardList[3] == boardList[6]:n18    elif boardList[0] == boardList[3] == boardList[6]:              
19        if boardList[0] == 1:19        if boardList[0] == 1:
20            return 'X'20            return 'X'
21        if boardList[0] == 2:21        if boardList[0] == 2:
22            return 'O'22            return 'O'
23    elif boardList[1] == boardList[4] == boardList[7]:23    elif boardList[1] == boardList[4] == boardList[7]:
24        if boardList[1] == 1:24        if boardList[1] == 1:
25            return 'X'25            return 'X'
26        if boardList[1] == 2:26        if boardList[1] == 2:
27            return 'O'27            return 'O'
n28    elif boardList[2] == boardList[5] == boardList[8]: n28    elif boardList[2] == boardList[5] == boardList[8]:
29        if boardList[2] == 1:29        if boardList[2] == 1:
30            return 'X'30            return 'X'
31        if boardList[2] == 2:31        if boardList[2] == 2:
32            return 'O'32            return 'O'
n33    elif boardList[0] == boardList[4] == boardList[8]:n33    elif boardList[0] == boardList[4] == boardList[8]:        
34        if boardList[0] == 1:34        if boardList[0] == 1:
35            return 'X'35            return 'X'
36        if boardList[0] == 2:36        if boardList[0] == 2:
37            return 'O'37            return 'O'
n38    elif boardList[2] == boardList[4] == boardList[6]:n38    elif boardList[6] == boardList[4] == boardList[2]:
39        if boardList[2] == 1:39        if boardList[6] == 1:
40            return 'X'40            return 'X'
n41        if boardList[2] == 2:n41        if boardList[6] == 2:
42            return 'O' 42            return 'O'
43    else:43    else:                                  
44        return '-'44        return '-'
45    pass45    pass
46def decodeBoard(nBoard):46def decodeBoard(nBoard):
47    boardList=[]47    boardList=[]
48    nRemainder=nBoard 48    nRemainder=nBoard 
n49    for digit in range(8,-1, -1): n49    for digit in range(8,-1,-1): 
50        x = nRemainder / (3**digit)50        x = nRemainder / (3**digit)
51        x = math.floor(x)51        x = math.floor(x)
52        nRemainder = nRemainder - ( x * (3**digit) )52        nRemainder = nRemainder - ( x * (3**digit) )
53        boardList.append(x)53        boardList.append(x)
54    return boardList54    return boardList
55if __name__=="__main__":55if __name__=="__main__":
n56    passn
57def countBases(seq):56    passdef countBases(seq):
58    A = 057    A = 0
59    C = 058    C = 0
60    G = 059    G = 0
61    T = 060    T = 0
n62    for user_number in seq:n61    for n in seq:
63        if user_number == 'A':62        if n == 'A':
64            A +=163            A += 1
65        elif user_number == 'C':64        elif n == 'C':
66            C +=1 65            C += 1
67        elif user_number == 'G':66        elif n == 'G':
68            G +=167            G += 1
69        elif user_number == 'T':68        elif n == 'T':
70            T += 169            T += 1
n71        else:n
72            print('Error')
73    cg_percentage = ((C+G)/len(seq))*10070    cg_percentage = ((C+G)/len(seq)) * 100
74    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)71    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
75def hammingdistance(seq_a, seq_b):72def hammingdistance(seq_a, seq_b):
n76    h_distance = 0n
77    if len(seq_a) != len(seq_b):73    if len(seq_a) != len(seq_b):
n78         return 'Error: Sequence Length Mismatch'n74        return('Error: Sequences Length Mismatch')
75    count = 0
79    for user_number in range(len(seq_a)):76    for n in range(len(seq_a)):
80        if seq_a[user_number] != seq_b[user_number]:77        if seq_a[n] != seq_b[n]:
81            h_distance += 178            count = count+1
82        else:79        else:
83            print('Error: Sequences Length Mismatch')80            print('Error: Sequences Length Mismatch')
t84    return h_distancet81    return count
85if __name__=="__main__":82if __name__=="__main__":
86    pass83    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 19

Student ID: 296, P-Value: 7.31e-03

Nearest Neighbor ID: 79

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
n4        if boardList[row*3] == 2:n
5            return 'O'
6        elif boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
7            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
8                return 'X'6                return 'X'
nn7            elif boardList[row*3] == 2:
8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
nn11            if boardList[col] == 1:
12                return 'X'
11            if boardList[col] == 2:13            elif boardList[col] == 2:
12                return 'O'14                return 'O'
nn15    if boardList[0] == boardList[4] == boardList[8]:
13            elif boardList[col] == 1:16        if boardList[0] == 1:
14                return 'X'17            return 'X'
18        elif boardList[0] == 2:
19            return 'O'
15    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
nn21        if boardList[2] == 1:
22            return 'X'
16        if boardList[2] == 2:23        elif boardList[2] == 2:
17            return 'O'24            return 'O'
n18        elif boardList[2] == 1:n
19            return 'X'
20    if boardList[0] == boardList[4] == boardList[8]:
21        if boardList[0] == 2:
22            return 'O'
23        elif boardList[0] == 1:
24            return 'X'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
n27    boardList=[]n27    boardList = []
28    nRemainder=nBoard 28    nRemainder = nBoard  
29    for digit in range (8, -1, -1):29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
n32        nRemainder = nRemainder - ( x * (3**digit) )n32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
34    return boardList34    return boardList
n35if __name__=="__main__":n
36    passdef countBases(seq):35def countBases(seq):
36    bases = ['A','C','G','T']
37    counts = []37    counts = []
n38    bases = ['A','C','G','T']n
39    for base in bases:38    for base in bases:
40        count = 039        count = 0
41        for char in seq:40        for char in seq:
42            if(base == char):41            if(base == char):
43                count += 142                count += 1
44        counts.append(count)43        counts.append(count)
n45    A=counts[0]n44    A = counts[0]
46    C=counts [1]45    C = counts[1]
47    G=counts[2]46    G = counts[2]
48    T=counts[3]47    T = counts[3]
49    cg_percentage = (C+G)*100 / len(seq)48    cg_percentage = (C+G)*100 / len(seq)
50    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
n51seq='ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'n50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'
52countBases(seq)51countBases(seq)
53def hammingdistance(seq_a, seq_b):52def hammingdistance(seq_a, seq_b):
54    if(len(seq_a) != len(seq_b)):53    if(len(seq_a) != len(seq_b)):
55        return "Error: Sequences Length Mismatch"54        return "Error: Sequences Length Mismatch"
56    else:55    else:
n57        count=0n56        count = 0
58        for char1,char2 in zip(seq_a,seq_b):57        for char1,char2 in zip(seq_a,seq_b):
59            if(char1 != char2):58            if(char1 != char2):
n60                count+=1n59                count += 1
61    return(count)60    return(count)
t62seq_a='GATATCGTCTGGGACCT't61seq_a = 'GATATCGTCTGGGACCT'
63seq_b='CATCGCATTTACGGCCT'62seq_b = 'CATCGCATTTACGGCCT'
64hammingdistance(seq_a, seq_b)63hammingdistance(seq_a, seq_b)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 20

Student ID: 239, P-Value: 7.86e-03

Nearest Neighbor ID: 301

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for down in range(3):3    for down in range(3):
n4        if boardList[down]==boardList[down+3]==boardList[down+6]== 1 or boardLisn4        if boardList[down]==boardList[down+3]==boardList[down+6]==1 or boardList
>t[2]==boardList[4] ==boardList[6]==1 or boardList[0]==boardList[4]==boardList[8]>[2]==boardList[4]==boardList[6]==1 or boardList[0]==boardList[4]==boardList[8]==
>==1:>1:
5            return 'X'5                return 'X'
6        if boardList[down]==boardList[down+3]==boardList[down+6]== 2 or boardLis6        if boardList[down]==boardList[down+3]==boardList[down+6]==2 or boardList
>t[2]==boardList[4] ==boardList[6]==2 or boardList[0]==boardList[4]==boardList[8]>[2]==boardList[4]==boardList[6]==2 or boardList[0]==boardList[4]==boardList[8]==
>==2:>2:
7            return 'O'7                return 'O'
8    for across in range(3):8    for across in range(3):
9        if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]:9        if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]:
n10            if boardList [across*3]==1:n10            if boardList[across*3]==1:
11                return 'X'11                return 'X'
12        if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]:12        if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]:
n13            if boardList [across*3]==2:n13            if boardList[across*3]==2:
14                return 'O'14                return 'O'
15    else:15    else:
16        return '-'16        return '-'
17    pass17    pass
18def decodeBoard(nBoard):18def decodeBoard(nBoard):
n19    boardList=[ ]n19    boardList=[]
20    nRemainder=nBoard 20    nRemainder=nBoard 
21    for digit in range(8,-1,-1): 21    for digit in range(8,-1,-1): 
22        x = nRemainder / (3**digit)22        x = nRemainder / (3**digit)
23        x = math.floor(x)23        x = math.floor(x)
24        nRemainder = nRemainder - ( x * (3**digit) )24        nRemainder = nRemainder - ( x * (3**digit) )
n25        boardList.append(x)        n25        boardList.append(x)
26    return boardList26    return boardList
27if __name__=="__main__":27if __name__=="__main__":
nn28    pass
28    passdef countBases(seq):29def countBases(seq):
29    A=seq.count('A')30    A=seq.count('A')
30    C=seq.count('C')31    C=seq.count('C')
31    G=seq.count('G')32    G=seq.count('G')
32    T=seq.count('T')33    T=seq.count('T')
n33    seq_1= C+Gn34    yuh=C + G
34    seq_2= C+G+T+A35    hi=C+G+T+A
35    cg_percentage = (seq_1/seq_2)*10036    cg_percentage = (yuh/hi)*100
36    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)37    return('{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage))
37def hammingdistance(seq_a, seq_b):38def hammingdistance(seq_a, seq_b):
n38    if (len(seq_a) !=len(seq_b)):n39    if len(seq_a)!=len(seq_b):
39        return ('Error: sequences length mismatch')40        return('Error: Sequences Length Mismatch')
40    else:41    else:
41        seq_a=set(seq_a)42        seq_a=set(seq_a)
42        seq_b=set(seq_b)43        seq_b=set(seq_b)
n43        seq=seq_a.symmetric_difference(seq_b)n44        ekk=seq_a.symmetric_difference(seq_b)
44        seq=set(seq)45        ekk=set(ekk)
45        seq=len(seq)46        ekk=len(ekk)
46        return 747        return 7
47if __name__=="__main__":48if __name__=="__main__":
t48    print('seq')t49    print('i want to cry')
49    pass50    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 21

Student ID: 301, P-Value: 7.86e-03

Nearest Neighbor ID: 239

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for down in range(3):3    for down in range(3):
n4        if boardList[down]==boardList[down+3]==boardList[down+6]==1 or boardListn4        if boardList[down]==boardList[down+3]==boardList[down+6]== 1 or boardLis
>[2]==boardList[4]==boardList[6]==1 or boardList[0]==boardList[4]==boardList[8]==>t[2]==boardList[4] ==boardList[6]==1 or boardList[0]==boardList[4]==boardList[8]
>1:>==1:
5                return 'X'5            return 'X'
6        if boardList[down]==boardList[down+3]==boardList[down+6]==2 or boardList6        if boardList[down]==boardList[down+3]==boardList[down+6]== 2 or boardLis
>[2]==boardList[4]==boardList[6]==2 or boardList[0]==boardList[4]==boardList[8]==>t[2]==boardList[4] ==boardList[6]==2 or boardList[0]==boardList[4]==boardList[8]
>2:>==2:
7                return 'O'7            return 'O'
8    for across in range(3):8    for across in range(3):
9        if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]:9        if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]:
n10            if boardList[across*3]==1:n10            if boardList [across*3]==1:
11                return 'X'11                return 'X'
12        if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]:12        if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]:
n13            if boardList[across*3]==2:n13            if boardList [across*3]==2:
14                return 'O'14                return 'O'
15    else:15    else:
16        return '-'16        return '-'
17    pass17    pass
18def decodeBoard(nBoard):18def decodeBoard(nBoard):
n19    boardList=[]n19    boardList=[ ]
20    nRemainder=nBoard 20    nRemainder=nBoard 
21    for digit in range(8,-1,-1): 21    for digit in range(8,-1,-1): 
22        x = nRemainder / (3**digit)22        x = nRemainder / (3**digit)
23        x = math.floor(x)23        x = math.floor(x)
24        nRemainder = nRemainder - ( x * (3**digit) )24        nRemainder = nRemainder - ( x * (3**digit) )
n25        boardList.append(x)n25        boardList.append(x)        
26    return boardList26    return boardList
27if __name__=="__main__":27if __name__=="__main__":
n28    passn
29def countBases(seq):28    passdef countBases(seq):
30    A=seq.count('A')29    A=seq.count('A')
31    C=seq.count('C')30    C=seq.count('C')
32    G=seq.count('G')31    G=seq.count('G')
33    T=seq.count('T')32    T=seq.count('T')
n34    yuh=C + Gn33    seq_1= C+G
35    hi=C+G+T+A34    seq_2= C+G+T+A
36    cg_percentage = (yuh/hi)*10035    cg_percentage = (seq_1/seq_2)*100
37    return('{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage))36    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
38def hammingdistance(seq_a, seq_b):37def hammingdistance(seq_a, seq_b):
n39    if len(seq_a)!=len(seq_b):n38    if (len(seq_a) !=len(seq_b)):
40        return('Error: Sequences Length Mismatch')39        return ('Error: sequences length mismatch')
41    else:40    else:
42        seq_a=set(seq_a)41        seq_a=set(seq_a)
43        seq_b=set(seq_b)42        seq_b=set(seq_b)
n44        ekk=seq_a.symmetric_difference(seq_b)n43        seq=seq_a.symmetric_difference(seq_b)
45        ekk=set(ekk)44        seq=set(seq)
46        ekk=len(ekk)45        seq=len(seq)
47        return 746        return 7
48if __name__=="__main__":47if __name__=="__main__":
t49    print('i want to cry')t48    print('seq')
50    pass49    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 22

Student ID: 30, P-Value: 8.06e-03

Nearest Neighbor ID: 116

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
n4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:n4        if boardList[row * 3] == boardList[row * 3 + 1] == boardList[row * 3 + 2
 >]:
5            if boardList[row*3] == 1:5            if boardList[row * 3] == 1:
6                return 'X'6                return 'X'
n7            elif boardList[row*3] == 2:n7            elif boardList[row * 3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
n10        if boardList[col] == boardList[col+3] == boardList[col+6]:n10        if boardList[col] == boardList[col + 3] == boardList[col + 6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
nn26    pass
26def decodeBoard(nBoard):27def decodeBoard(nBoard):
n27    boardList = []n28    boardList=[]
28    nRemainder = nBoard  29    nRemainder=nBoard 
29    for digit in range(8, -1, -1):30    for digit in range(8, -1, -1): 
30        x = nRemainder / (3**digit)31        x = nRemainder / (3**digit)
31        x = math.floor(x)32        x = math.floor(x)
n32        nRemainder = nRemainder - (x * (3**digit))n33        nRemainder = nRemainder - ( x * (3**digit) )
33        boardList.append(x)34        boardList.append(x)
34    return boardList35    return boardList
35if __name__=="__main__":36if __name__=="__main__":
36    passdef countBases(seq):37    passdef countBases(seq):
37    A = 038    A = 0
38    C = 039    C = 0
39    G = 040    G = 0
40    T = 041    T = 0
n41    for n in range(len(seq)):n42    for i in range(len(seq)):
42        if seq[n] == 'A':43        if seq[i] == 'A':
43            A += 144            A += 1
n44        elif seq[n] == 'C':n45        if seq[i] == 'C':
45            C += 146            C += 1
n46        elif seq[n] == 'G':n47        if seq[i] == 'G':
47            G += 148            G += 1
n48        elif seq[n] == 'T':n49        if seq[i] == 'T':
49            T += 150            T += 1
n50    cg_percentage = (C + G) / len(seq) * 100n51    cg_percentage = float(((C + G) /  (A + C + G + T)) * 100)
51    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)52    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
52def hammingdistance(seq_a, seq_b):53def hammingdistance(seq_a, seq_b):
n53    diff = 0n54    count = 0
54    if len(seq_a) == len(seq_b):55    if len(seq_a) != len(seq_b):
56        return 'Error: Sequences Length Mismatch'
57    else:
55        for i in range(len(seq_a)):58        for i in range(len(seq_a)):
56            if seq_a[i] != seq_b[i]:59            if seq_a[i] != seq_b[i]:
t57                diff += 1t60                count += 1
58        return diff61        return count        
59    else:
60        return 'Error: Sequences Length Mismatch'
61if __name__=="__main__":62if __name__=="__main__":
62    pass63    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 23

Student ID: 116, P-Value: 8.06e-03

Nearest Neighbor ID: 30

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
n4        if boardList[row * 3] == boardList[row * 3 + 1] == boardList[row * 3 + 2n4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
>]: 
5            if boardList[row * 3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
n7            elif boardList[row * 3] == 2:n7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
n10        if boardList[col] == boardList[col + 3] == boardList[col + 6]:n10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
n26    passn
27def decodeBoard(nBoard):26def decodeBoard(nBoard):
n28    boardList=[]n27    boardList = []
29    nRemainder=nBoard 28    nRemainder = nBoard  
30    for digit in range(8, -1, -1): 29    for digit in range(8, -1, -1):
31        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
32        x = math.floor(x)31        x = math.floor(x)
n33        nRemainder = nRemainder - ( x * (3**digit) )n32        nRemainder = nRemainder - (x * (3**digit))
34        boardList.append(x)33        boardList.append(x)
35    return boardList34    return boardList
36if __name__=="__main__":35if __name__=="__main__":
37    passdef countBases(seq):36    passdef countBases(seq):
38    A = 037    A = 0
39    C = 038    C = 0
40    G = 039    G = 0
41    T = 040    T = 0
n42    for i in range(len(seq)):n41    for n in range(len(seq)):
43        if seq[i] == 'A':42        if seq[n] == 'A':
44            A += 143            A += 1
n45        if seq[i] == 'C':n44        elif seq[n] == 'C':
46            C += 145            C += 1
n47        if seq[i] == 'G':n46        elif seq[n] == 'G':
48            G += 147            G += 1
n49        if seq[i] == 'T':n48        elif seq[n] == 'T':
50            T += 149            T += 1
n51    cg_percentage = float(((C + G) /  (A + C + G + T)) * 100)n50    cg_percentage = (C + G) / len(seq) * 100
52    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)51    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
53def hammingdistance(seq_a, seq_b):52def hammingdistance(seq_a, seq_b):
n54    count = 0n53    diff = 0
55    if len(seq_a) != len(seq_b):54    if len(seq_a) == len(seq_b):
56        return 'Error: Sequences Length Mismatch'
57    else:
58        for i in range(len(seq_a)):55        for i in range(len(seq_a)):
59            if seq_a[i] != seq_b[i]:56            if seq_a[i] != seq_b[i]:
t60                count += 1t57                diff += 1
61        return count        58        return diff
59    else:
60        return 'Error: Sequences Length Mismatch'
62if __name__=="__main__":61if __name__=="__main__":
63    pass62    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 24

Student ID: 467, P-Value: 1.07e-02

Nearest Neighbor ID: 116

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
nn3    for row in range(3):
3    if boardList[0] == boardList[1] == boardList[2]:4        if boardList[row * 3] == boardList[row * 3 + 1] == boardList[row * 3 + 2
 >]:
4        if boardList[0] == 1:5            if boardList[row * 3] == 1:
5            return 'X'6                return 'X'
6        if boardList[0] == 2:7            elif boardList[row * 3] == 2:
7            return 'O'8                return 'O'
9    for col in range(3):
8    if boardList[3] == boardList[4] == boardList[5]:10        if boardList[col] == boardList[col + 3] == boardList[col + 6]:
9        if boardList[3] == 1:11            if boardList[col] == 1:
10            return 'X'12                return 'X'
11        if boardList[3] == 2:13            elif boardList[col] == 2:
12            return 'O'14                return 'O'
13    if boardList[6] == boardList[7] == boardList[8]:
14        if boardList[6] == 1:
15            return 'X'
16        if boardList[6] == 2:
17            return 'O'
18    if boardList[0] == boardList[3] == boardList[6]:
19        if boardList[0] == 1:
20            return 'X'
21        if boardList[0] == 2:
22            return 'O'
23    if boardList[1] == boardList[4] == boardList[7]:
24        if boardList[1] == 1:
25            return 'X'
26        if boardList[1] == 2:
27            return 'O'
28    if boardList[2] == boardList[5] == boardList[8]:
29        if boardList[2] == 1:
30            return 'X'
31        if boardList[2] == 2:
32            return 'O'
33    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
34        if boardList[0] == 1:16        if boardList[0] == 1:
35            return 'X'17            return 'X'
n36        if boardList[0] == 2:n18        elif boardList[0] == 2:
37            return 'O'19            return 'O'
38    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
39        if boardList[2] == 1:21        if boardList[2] == 1:
40            return 'X'22            return 'X'
n41        if boardList[2] == 2:n23        elif boardList[2] == 2:
42            return 'O'24            return 'O'
43    return '-'25    return '-'
nn26    pass
44def decodeBoard(nBoard):27def decodeBoard(nBoard):
45    boardList=[]28    boardList=[]
46    nRemainder=nBoard 29    nRemainder=nBoard 
47    for digit in range(8, -1, -1): 30    for digit in range(8, -1, -1): 
48        x = nRemainder / (3**digit)31        x = nRemainder / (3**digit)
49        x = math.floor(x)32        x = math.floor(x)
50        nRemainder = nRemainder - ( x * (3**digit) )33        nRemainder = nRemainder - ( x * (3**digit) )
n51        boardList.append(x)        n34        boardList.append(x)
52    return boardList35    return boardList
53if __name__=="__main__":36if __name__=="__main__":
54    passdef countBases(seq):37    passdef countBases(seq):
55    A = 038    A = 0
56    C = 039    C = 0
57    G = 040    G = 0
58    T = 041    T = 0
n59    cg_percentage = 0.0n
60    for i in range(0, len(seq)):42    for i in range(len(seq)):
61        if seq[i] == 'A':43        if seq[i] == 'A':
62            A += 144            A += 1
63        if seq[i] == 'C':45        if seq[i] == 'C':
64            C += 146            C += 1
65        if seq[i] == 'G':47        if seq[i] == 'G':
66            G += 148            G += 1
67        if seq[i] == 'T':49        if seq[i] == 'T':
68            T += 150            T += 1
n69    cg_percentage = ((C + G) / len(seq)) * 100n51    cg_percentage = float(((C + G) /  (A + C + G + T)) * 100)
70    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)52    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
71def hammingdistance(seq_a, seq_b):53def hammingdistance(seq_a, seq_b):
72    count = 054    count = 0
73    if len(seq_a) != len(seq_b):55    if len(seq_a) != len(seq_b):
n74        return "Error: Sequences Length Mismatch"n56        return 'Error: Sequences Length Mismatch'
75    else:57    else:
n76        for i in range(0, len(seq_a)):n58        for i in range(len(seq_a)):
77            if seq_a[i] != seq_b[i]:59            if seq_a[i] != seq_b[i]:
78                count += 160                count += 1
t79    return countt61        return count        
80if __name__=="__main__":62if __name__=="__main__":
81    pass63    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 25

Student ID: 65, P-Value: 1.40e-02

Nearest Neighbor ID: 176

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
4        return 'X'4        return 'X'
nn5    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
6        return 'X'
7    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
8        return 'X'
9    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
10        return 'X'
11    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
12        return 'X'
13    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
14        return 'X'
15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
16        return 'X'
17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
18        return 'X'
5    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
6        return 'O'20        return 'O'
n7    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:n21    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
8        return 'X'22        return 'O'
23    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
24        return 'O'
25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
26        return 'O'
9    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:27    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
10        return 'O'28        return 'O'
n11    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:n
12        return 'X'
13    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:29    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
14        return 'O'30        return 'O'
n15    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:n
16        return 'X'
17    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
18        return 'O'
19    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
20        return 'X'
21    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
22        return 'O'
23    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
24        return 'X'
25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
26        return 'O'
27    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
28        return 'X'
29    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
30        return 'O'32        return 'O'
n31    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:n
32        return 'X'
33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
34        return 'O'34        return 'O'
35    else:35    else:
36        return '-'36        return '-'
nn37    pass
37def decodeBoard(nBoard):38def decodeBoard(nBoard):
38    boardList=[]39    boardList=[]
n39    nRemainder=nBoardn40    nRemainder=nBoard 
40    for digit in range(8, -1, -1):41    for digit in range(8,-1,-1): 
41        x = nRemainder / (3**digit)42        x = nRemainder / (3**digit)
42        x = math.floor(x)43        x = math.floor(x)
43        nRemainder = nRemainder - ( x * (3**digit) )44        nRemainder = nRemainder - ( x * (3**digit) )
n44        boardList.append(x)    n45        boardList.append(x)
45    return boardList46    return boardList
46if __name__=="__main__":47if __name__=="__main__":
n47    print(decodeBoard(1815))n
48    passdef countBases(seq):48    passdef countBases(seq_a):
49    A = seq.count('A')49    A = 0
50    C = seq.count('C')50    C = 0
51    G = seq.count('G')51    G = 0
52    T = seq.count('T')52    T = 0
53    Total = A + C + G + T53    for d in seq_a:
54        if d == 'A':
55             A += 1
56        elif d == 'C':
57            C += 1
58        elif d == 'G':
59            G += 1
60        elif d == 'T':
61            T += 1
54    cg_percentage = ((C + G) / Total) * 10062    cg_percentage = float((C + G) / ((len(seq_a))) * 100)
55    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)63    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
56def hammingdistance(seq_a, seq_b):64def hammingdistance(seq_a, seq_b):
n57    diff = 0n
58    if len(seq_a) == len(seq_b):65    if len(seq_a) == len(seq_b):
nn66        diff = 0
59        for i in range(len(seq_a)):67        for i in range(len(seq_a)):
60            if seq_a[i] != seq_b[i]:68            if seq_a[i] != seq_b[i]:
61                diff += 169                diff += 1
n62        return (diff)n
63    else:70    else:
t64        return "Error: Sequences Length Mismatch"t71        return 'Error: Sequences Length Mismatch'
72    return diff
65if __name__=="__main__":73if __name__=="__main__":
66    pass74    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 26

Student ID: 176, P-Value: 1.40e-02

Nearest Neighbor ID: 65

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
4        return 'X'4        return 'X'
nn5    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
6        return 'O'
7    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
8        return 'X'
9    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
10        return 'O'
11    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
12        return 'X'
13    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
14        return 'O'
5    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:15    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
6        return 'X'16        return 'X'
nn17    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
18        return 'O'
7    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:19    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
8        return 'X'20        return 'X'
nn21    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
22        return 'O'
9    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:23    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
10        return 'X'24        return 'X'
n11    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:n25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
12        return 'X'26        return 'O'
13    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
14        return 'X'
15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:27    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
16        return 'X'28        return 'X'
nn29    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
30        return 'O'
17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:31    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
18        return 'X'32        return 'X'
n19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:n
20        return 'O'
21    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
22        return 'O'
23    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
24        return 'O'
25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
26        return 'O'
27    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
28        return 'O'
29    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
30        return 'O'
31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
32        return 'O'
33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
34        return 'O'34        return 'O'
35    else:35    else:
36        return '-'36        return '-'
n37    passn
38def decodeBoard(nBoard):37def decodeBoard(nBoard):
39    boardList=[]38    boardList=[]
n40    nRemainder=nBoard n39    nRemainder=nBoard
41    for digit in range(8,-1,-1): 40    for digit in range(8, -1, -1):
42        x = nRemainder / (3**digit)41        x = nRemainder / (3**digit)
43        x = math.floor(x)42        x = math.floor(x)
44        nRemainder = nRemainder - ( x * (3**digit) )43        nRemainder = nRemainder - ( x * (3**digit) )
n45        boardList.append(x)n44        boardList.append(x)    
46    return boardList45    return boardList
47if __name__=="__main__":46if __name__=="__main__":
nn47    print(decodeBoard(1815))
48    passdef countBases(seq_a):48    passdef countBases(seq):
49    A = 049    A = seq.count('A')
50    C = 050    C = seq.count('C')
51    G = 051    G = seq.count('G')
52    T = 052    T = seq.count('T')
53    for d in seq_a:53    Total = A + C + G + T
54        if d == 'A':
55             A += 1
56        elif d == 'C':
57            C += 1
58        elif d == 'G':
59            G += 1
60        elif d == 'T':
61            T += 1
62    cg_percentage = float((C + G) / ((len(seq_a))) * 100)54    cg_percentage = ((C + G) / Total) * 100
63    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)55    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
64def hammingdistance(seq_a, seq_b):56def hammingdistance(seq_a, seq_b):
nn57    diff = 0
65    if len(seq_a) == len(seq_b):58    if len(seq_a) == len(seq_b):
n66        diff = 0n
67        for i in range(len(seq_a)):59        for i in range(len(seq_a)):
68            if seq_a[i] != seq_b[i]:60            if seq_a[i] != seq_b[i]:
69                diff += 161                diff += 1
nn62        return (diff)
70    else:63    else:
t71        return 'Error: Sequences Length Mismatch't64        return "Error: Sequences Length Mismatch"
72    return diff
73if __name__=="__main__":65if __name__=="__main__":
74    pass66    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 27

Student ID: 193, P-Value: 1.43e-02

Nearest Neighbor ID: 79

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
n4        if boardList[row * 3] == boardList[row * 3 + 1] == boardList[row * 3 + 2n4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
>]: 
5            if boardList[row * 3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
n7            elif boardList[row * 3] == 2:n7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
n9    for column in range(3):n9    for col in range(3):
10        if boardList[column] == boardList[column + 3] == boardList[column + 6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[column] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
n13            elif boardList[column] == 2:n13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
n27    boardList=[]n27    boardList = []
28    nRemainder=nBoard 28    nRemainder = nBoard  
29    for digit in range(8, -1, -1): 29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
n32        nRemainder = nRemainder - ( x * (3**digit) )n32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)      33        boardList.append(x)
34    return boardList34    return boardList
n35if __name__=="__main__":n
36    passdef countBases(seq):35def countBases(seq):
37    bases = ['A','C','G','T']36    bases = ['A','C','G','T']
38    counts = []37    counts = []
39    for base in bases:38    for base in bases:
40        count = 039        count = 0
41        for char in seq:40        for char in seq:
42            if(base == char):41            if(base == char):
43                count += 142                count += 1
44        counts.append(count)43        counts.append(count)
45    A = counts[0]44    A = counts[0]
46    C = counts[1]45    C = counts[1]
47    G = counts[2]46    G = counts[2]
48    T = counts[3]47    T = counts[3]
n49    cg_percentage = ((C+G)*100) / (len(seq))n48    cg_percentage = (C+G)*100 / len(seq)
50    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)49    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
51seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'50seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT'
52countBases(seq)51countBases(seq)
53def hammingdistance(seq_a, seq_b):52def hammingdistance(seq_a, seq_b):
54    if(len(seq_a) != len(seq_b)):53    if(len(seq_a) != len(seq_b)):
n55        return 'Error: Sequences Length Mismatch'n54        return "Error: Sequences Length Mismatch"
56    else:55    else:
57        count = 056        count = 0
n58        for charA,charB in zip(seq_a,seq_b):n57        for char1,char2 in zip(seq_a,seq_b):
59            if(charA != charB):58            if(char1 != char2):
60                count += 159                count += 1
61    return(count)60    return(count)
62seq_a = 'GATATCGTCTGGGACCT'61seq_a = 'GATATCGTCTGGGACCT'
t63seq_b = 'CCATCGCATTTACGGCCT't62seq_b = 'CATCGCATTTACGGCCT'
64hammingdistance(seq_a, seq_b)63hammingdistance(seq_a, seq_b)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 28

Student ID: 73, P-Value: 1.46e-02

Nearest Neighbor ID: 497

Student (left) and Nearest Neighbor (right).


f1def findWinner(boardList):f1def findWinner(boardList):
2    if (boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1) or (board2    if (boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1) or (board
>List[3] == 1 and boardList[4] == 1 and boardList[5] == 1) or (boardList[6] == 1 >List[3] == 1 and boardList[4] == 1 and boardList[5] == 1) or (boardList[6] == 1 
>and boardList[7] == 1 and boardList[8] == 1):>and boardList[7] == 1 and boardList[8] == 1):
n3        return 'X'n3        return "X"
4    if (boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1) or (board4    elif (boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1) or (boa
>List[1] == 1 and boardList[4] == 1 and boardList[7] == 1) or (boardList[2] == 1 >rdList[1] == 1 and boardList[4] == 1 and boardList[7] == 1) or (boardList[2] == 
>and boardList[5] == 1 and boardList[8] == 1):>1 and boardList[5] == 1 and boardList[8] == 1):
5        return 'X'5        return "X"
6    if (boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1) or (board6    elif (boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1) or (boa
>List[2] == 1 and boardList[4] == 1 and boardList[6] == 1):>rdList[2] == 1 and boardList[4] == 1 and boardList[6] == 1):
7        return 'X'7        return "X"
8    if (boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2) or (board8    elif (boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2) or (boa
>List[3] == 2 and boardList[4] == 2 and boardList[5] == 2) or (boardList[6] == 2 >rdList[3] == 2 and boardList[4] == 2 and boardList[5] == 2) or (boardList[6] == 
>and boardList[7] == 2 and boardList[8]==2):>2 and boardList[7] == 2 and boardList[8] == 2):
9        return 'O'9        return "O"
10    if (boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2) or (board10    elif (boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2) or (boa
>List[1] == 2 and boardList[4] == 2 and boardList[7] == 2) or (boardList[2] == 2 >rdList[1] == 2 and boardList[4] == 2 and boardList[7] == 2) or (boardList[2] == 
>and boardList[5] == 2 and boardList[8] == 2):>2 and boardList[5] == 2 and boardList[8] == 2):
11        return 'O'11        return "O"
12    if (boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2) or (board12    elif (boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2) or (boa
>List[2] == 2 and boardList[4] == 2 and boardList[6] == 2):>rdList[2] == 2 and boardList[4] == 2 and boardList[6] == 2):
13        return 'O'13        return "O"
14    else:14    else:
n15        return '-'n15        return "-"
16def decodeBoard(nBoard):16def decodeBoard(nBoard):
17    import math17    import math
18    boardList=[]18    boardList=[]
19    nRemainder=nBoard 19    nRemainder=nBoard 
20    for digit in range(8, -1, -1): 20    for digit in range(8, -1, -1): 
21        x = nRemainder / (3**digit)21        x = nRemainder / (3**digit)
22        x = math.floor(x)22        x = math.floor(x)
23        nRemainder = nRemainder - ( x * (3**digit) )23        nRemainder = nRemainder - ( x * (3**digit) )
n24        boardList.append(x)   n24        boardList.append(x)
25    return boardList25    return boardList
26if __name__=="__main__":26if __name__=="__main__":
27    passdef countBases(seq):27    passdef countBases(seq):
n28    A=0n28    A, C, G, T = 0, 0, 0 ,0
29    C=029    base_list = ["A", "C", "G", "T"]
30    G=0
31    T=0
32    lists = ['A','C','G','T']
33    for base in seq:30    for base in seq:
n34        if base == lists[0]:n31        if base == base_list[0]:
35            A += 132            A += 1
n36        elif base == lists[1]:n33        elif base == base_list[1]:
37            C += 134            C += 1
n38        elif base == lists[2]:n35        elif base == base_list[2]:
39            G += 136            G += 1
n40        elif base == lists[3]:n37        elif base == base_list[3]:
41            T += 138            T += 1
n42        cg_percentage = ((C + G)/(A + C + G + T)) * 100n39        cg_percentage = ((C + G) / (A + C + G + T)) * 100
43    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
44def hammingdistance(seq_a, seq_b):41def hammingdistance(seq_a, seq_b):
45    if len(seq_a) != len(seq_b):42    if len(seq_a) != len(seq_b):
n46        return 'Error: Sequences Length Mismatch'n43        return "Error: Sequences Length Mismatch"
47    else:44    else:
48        count = 045        count = 0
49        for i in range(len(seq_a)):46        for i in range(len(seq_a)):
50            if seq_a[i] != seq_b[i]:47            if seq_a[i] != seq_b[i]:
t51                count = count + 1t48                count += 1
52        return count49        return count
53if __name__=="__main__":50if __name__=="__main__":
54    pass51    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 29

Student ID: 497, P-Value: 1.46e-02

Nearest Neighbor ID: 73

Student (left) and Nearest Neighbor (right).


f1def findWinner(boardList):f1def findWinner(boardList):
2    if (boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1) or (board2    if (boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1) or (board
>List[3] == 1 and boardList[4] == 1 and boardList[5] == 1) or (boardList[6] == 1 >List[3] == 1 and boardList[4] == 1 and boardList[5] == 1) or (boardList[6] == 1 
>and boardList[7] == 1 and boardList[8] == 1):>and boardList[7] == 1 and boardList[8] == 1):
n3        return "X"n3        return 'X'
4    elif (boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1) or (boa4    if (boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1) or (board
>rdList[1] == 1 and boardList[4] == 1 and boardList[7] == 1) or (boardList[2] == >List[1] == 1 and boardList[4] == 1 and boardList[7] == 1) or (boardList[2] == 1 
>1 and boardList[5] == 1 and boardList[8] == 1):>and boardList[5] == 1 and boardList[8] == 1):
5        return "X"5        return 'X'
6    elif (boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1) or (boa6    if (boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1) or (board
>rdList[2] == 1 and boardList[4] == 1 and boardList[6] == 1):>List[2] == 1 and boardList[4] == 1 and boardList[6] == 1):
7        return "X"7        return 'X'
8    elif (boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2) or (boa8    if (boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2) or (board
>rdList[3] == 2 and boardList[4] == 2 and boardList[5] == 2) or (boardList[6] == >List[3] == 2 and boardList[4] == 2 and boardList[5] == 2) or (boardList[6] == 2 
>2 and boardList[7] == 2 and boardList[8] == 2):>and boardList[7] == 2 and boardList[8]==2):
9        return "O"9        return 'O'
10    elif (boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2) or (boa10    if (boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2) or (board
>rdList[1] == 2 and boardList[4] == 2 and boardList[7] == 2) or (boardList[2] == >List[1] == 2 and boardList[4] == 2 and boardList[7] == 2) or (boardList[2] == 2 
>2 and boardList[5] == 2 and boardList[8] == 2):>and boardList[5] == 2 and boardList[8] == 2):
11        return "O"11        return 'O'
12    elif (boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2) or (boa12    if (boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2) or (board
>rdList[2] == 2 and boardList[4] == 2 and boardList[6] == 2):>List[2] == 2 and boardList[4] == 2 and boardList[6] == 2):
13        return "O"13        return 'O'
14    else:14    else:
n15        return "-"n15        return '-'
16def decodeBoard(nBoard):16def decodeBoard(nBoard):
17    import math17    import math
18    boardList=[]18    boardList=[]
19    nRemainder=nBoard 19    nRemainder=nBoard 
20    for digit in range(8, -1, -1): 20    for digit in range(8, -1, -1): 
21        x = nRemainder / (3**digit)21        x = nRemainder / (3**digit)
22        x = math.floor(x)22        x = math.floor(x)
23        nRemainder = nRemainder - ( x * (3**digit) )23        nRemainder = nRemainder - ( x * (3**digit) )
n24        boardList.append(x)n24        boardList.append(x)   
25    return boardList25    return boardList
26if __name__=="__main__":26if __name__=="__main__":
27    passdef countBases(seq):27    passdef countBases(seq):
n28    A, C, G, T = 0, 0, 0 ,0n28    A=0
29    base_list = ["A", "C", "G", "T"]29    C=0
30    G=0
31    T=0
32    lists = ['A','C','G','T']
30    for base in seq:33    for base in seq:
n31        if base == base_list[0]:n34        if base == lists[0]:
32            A += 135            A += 1
n33        elif base == base_list[1]:n36        elif base == lists[1]:
34            C += 137            C += 1
n35        elif base == base_list[2]:n38        elif base == lists[2]:
36            G += 139            G += 1
n37        elif base == base_list[3]:n40        elif base == lists[3]:
38            T += 141            T += 1
n39        cg_percentage = ((C + G) / (A + C + G + T)) * 100n42        cg_percentage = ((C + G)/(A + C + G + T)) * 100
40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)43    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
41def hammingdistance(seq_a, seq_b):44def hammingdistance(seq_a, seq_b):
42    if len(seq_a) != len(seq_b):45    if len(seq_a) != len(seq_b):
n43        return "Error: Sequences Length Mismatch"n46        return 'Error: Sequences Length Mismatch'
44    else:47    else:
45        count = 048        count = 0
46        for i in range(len(seq_a)):49        for i in range(len(seq_a)):
47            if seq_a[i] != seq_b[i]:50            if seq_a[i] != seq_b[i]:
t48                count += 1t51                count = count + 1
49        return count52        return count
50if __name__=="__main__":53if __name__=="__main__":
51    pass54    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 30

Student ID: 231, P-Value: 1.66e-02

Nearest Neighbor ID: 65

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
4        return 'X'4        return 'X'
nn5    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
6        return 'O'
5    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:7    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
6        return 'X'8        return 'X'
nn9    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
10        return 'O'
7    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:11    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
8        return 'X'12        return 'X'
nn13    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
14        return 'O'
9    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:15    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
10        return 'X'16        return 'X'
nn17    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
18        return 'O'
11    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:19    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
12        return 'X'20        return 'X'
nn21    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
22        return 'O'
13    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:23    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
14        return 'X'24        return 'X'
nn25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
26        return 'O'
15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:27    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
16        return 'X'28        return 'X'
nn29    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
30        return 'O'
17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:31    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
18        return 'X'32        return 'X'
n19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:n
20        return 'O'
21    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
22        return 'O'
23    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
24        return 'O'
25    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
26        return 'O'
27    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
28        return 'O'
29    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
30        return 'O'
31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
32        return 'O'
33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
34        return 'O'34        return 'O'
35    else:35    else:
36        return '-'36        return '-'
n37    passn
38def decodeBoard(nBoard):37def decodeBoard(nBoard):
39    boardList=[]38    boardList=[]
n40    nRemainder=nBoard n39    nRemainder=nBoard
41    for digit in range(8,-1,-1): 40    for digit in range(8, -1, -1):
42        x = nRemainder / (3**digit)41        x = nRemainder / (3**digit)
43        x = math.floor(x)42        x = math.floor(x)
44        nRemainder = nRemainder - ( x * (3**digit) )43        nRemainder = nRemainder - ( x * (3**digit) )
n45        boardList.append(x)n44        boardList.append(x)    
46    print(boardList)
47    return boardList45    return boardList
48if __name__=="__main__":46if __name__=="__main__":
n49    decodeBoard(2291)n47    print(decodeBoard(1815))
50    passfrom itertools import count
51def countBases(seq):48    passdef countBases(seq):
52    A = seq.count('A')49    A = seq.count('A')
53    C = seq.count('C')50    C = seq.count('C')
54    G = seq.count('G')51    G = seq.count('G')
55    T = seq.count('T')52    T = seq.count('T')
nn53    Total = A + C + G + T
56    c_percentage = C / len(seq) * 10054    cg_percentage = ((+ G) Total) * 100
57    g_percentage = G / len(seq) * 100
58    cg_percentage = c_percentage + g_percentage
59    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)55    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
60def hammingdistance(seq_a, seq_b):56def hammingdistance(seq_a, seq_b):
n61    count1 = 0n57    diff = 0
62    if len(seq_a) == len(seq_b):58    if len(seq_a) == len(seq_b):
63        for i in range(len(seq_a)):59        for i in range(len(seq_a)):
64            if seq_a[i] != seq_b[i]:60            if seq_a[i] != seq_b[i]:
n65                count1 += 1n61                diff += 1
62        return (diff)
66    else:63    else:
t67        return 'Error: Sequences Length Mismatch't64        return "Error: Sequences Length Mismatch"
68    return count1
69if __name__=="__main__":65if __name__=="__main__":
70    pass66    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 31

Student ID: 196, P-Value: 2.03e-02

Nearest Neighbor ID: 176

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
4        return 'X'4        return 'X'
nn5    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
6        return 'X'
7    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
8        return 'X'
9    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
10        return 'X'
11    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
12        return 'X'
13    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
14        return 'X'
15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
16        return 'X'
17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
18        return 'X'
5    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
6        return 'O'20        return 'O'
n7    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:n21    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
8        return 'X'22        return 'O'
23    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
24        return 'O'
25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
26        return 'O'
9    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:27    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
10        return 'O'28        return 'O'
n11    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:n
12        return 'X'
13    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:29    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
14        return 'O'30        return 'O'
n15    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:n
16        return 'X'
17    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
18        return 'O'
19    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
20        return 'X'
21    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
22        return 'O'
23    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
24        return 'X'
25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
26        return 'O'
27    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
28        return 'X'
29    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
30        return 'O'32        return 'O'
n31    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:n
32        return 'X'
33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
34        return 'O'34        return 'O'
35    else:35    else:
36        return '-'36        return '-'
37    pass37    pass
38def decodeBoard(nBoard):38def decodeBoard(nBoard):
39    boardList=[]39    boardList=[]
40    nRemainder=nBoard 40    nRemainder=nBoard 
n41    for digit in range(8, -1, -1): n41    for digit in range(8,-1,-1): 
42        x = nRemainder / (3**digit)42        x = nRemainder / (3**digit)
43        x = math.floor(x)43        x = math.floor(x)
44        nRemainder = nRemainder - ( x * (3**digit) )44        nRemainder = nRemainder - ( x * (3**digit) )
45        boardList.append(x)45        boardList.append(x)
46    return boardList46    return boardList
47if __name__=="__main__":47if __name__=="__main__":
n48    passdef countBases(seq):n48    passdef countBases(seq_a):
49    A = 049    A = 0
n50    for i in seq:n
51        if i == 'A':
52            A = A + 1
53    C = 050    C = 0
n54    for j in seq:n
55        if j == 'C':
56            C = C + 1
57    G = 051    G = 0
n58    for k in seq:n
59        if k == 'G':
60            G = G + 1
61    T = 052    T = 0
n62    for l in seq:n53    for d in seq_a:
54        if d == 'A':
55             A += 1
56        elif d == 'C':
57            C += 1
58        elif d == 'G':
59            G += 1
63        if l == 'T':60        elif d == 'T':
64            T = T + 161            T += 1
65    cg_percentage = (C + G)/len(seq) * 10062    cg_percentage = float((C + G) / ((len(seq_a))) * 100)
66    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)63    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
67def hammingdistance(seq_a, seq_b):64def hammingdistance(seq_a, seq_b):
n68    if len(seq_a) != len(seq_b):n65    if len(seq_a) == len(seq_b):
66        diff = 0
67        for i in range(len(seq_a)):
68            if seq_a[i] != seq_b[i]:
69                diff += 1
70    else:
69        return 'Error: Sequences Length Mismatch'71        return 'Error: Sequences Length Mismatch'
t70    count = 0t72    return diff
71    for i in range(len(seq_a)):
72        if seq_a[i] != seq_b[i]:
73            count = count + 1
74    return count
75if __name__=="__main__":73if __name__=="__main__":
76    pass74    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 32

Student ID: 290, P-Value: 2.08e-02

Nearest Neighbor ID: 176

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
4        return 'X'4        return 'X'
n5    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:n
6        return 'X'
7    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
8        return 'X' 
9    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:5    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
10        return 'X'6        return 'X'
11    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:7    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
12        return 'X'8        return 'X'
13    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:9    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
nn10        return 'X'
11    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
12        return 'X'
13    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
14        return 'X'14        return 'X'
15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
16        return 'X'16        return 'X'
17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
18        return 'X'18        return 'X'
19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
20        return 'O'20        return 'O'
n21    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:n
22        return 'O'
23    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
24        return 'O'
25    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:21    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
26        return 'O'22        return 'O'
27    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:23    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
28        return 'O'24        return 'O'
29    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
nn26        return 'O'
27    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
28        return 'O'
29    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
30        return 'O'30        return 'O'
31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
32        return 'O'32        return 'O'
33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
34        return 'O'34        return 'O'
35    else:35    else:
36        return '-'36        return '-'
nn37    pass
37def decodeBoard(nBoard):38def decodeBoard(nBoard):
38    boardList=[]39    boardList=[]
39    nRemainder=nBoard 40    nRemainder=nBoard 
n40    for digit in reversed(range(9)): n41    for digit in range(8,-1,-1): 
41        x = nRemainder / (3**digit)42        x = nRemainder / (3**digit)
42        x = math.floor(x)43        x = math.floor(x)
n43        nRemainder = nRemainder - (x * (3**digit))n44        nRemainder = nRemainder - ( x * (3**digit) )
44        boardList.append(x) 45        boardList.append(x)
45    return boardList46    return boardList
46if __name__=="__main__":47if __name__=="__main__":
n47    passdef countBases(seq):n48    passdef countBases(seq_a):
48    A = 049    A = 0
49    C = 050    C = 0
50    G = 051    G = 0
51    T = 052    T = 0
n52    for x in seq:n53    for d in seq_a:
53        if x == 'A':54        if d == 'A':
54            A += 155             A += 1
55        if x == 'C':56        elif d == 'C':
56            C += 157            C += 1
n57        if x == 'G':n58        elif d == 'G':
58            G += 159            G += 1
n59        if x == 'T':n60        elif d == 'T':
60            T += 161            T += 1
n61    cg_percentage = ((C+G)/(A+C+G+T)) * 100n62    cg_percentage = float((C + G) / ((len(seq_a))) * 100)
62    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)63    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
63def hammingdistance(seq_a, seq_b):64def hammingdistance(seq_a, seq_b):
n64    Dh = 0n
65    if len(seq_a) == len(seq_b):65    if len(seq_a) == len(seq_b):
nn66        diff = 0
66        for x in range(len(seq_a)):67        for i in range(len(seq_a)):
67            if seq_a[x] != seq_b[x]:68            if seq_a[i] != seq_b[i]:
68                Dh += 169                diff += 1
69        return Dh
70    else:70    else:
t71        return ('Error: Sequences Length Mismatch')t71        return 'Error: Sequences Length Mismatch'
72    return diff
72if __name__=="__main__":73if __name__=="__main__":
73    pass74    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 33

Student ID: 63, P-Value: 2.57e-02

Nearest Neighbor ID: 176

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
nn4        return 'X'
5    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
6        return 'X'
7    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
8        return 'X'
9    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
4        return 'X'10        return 'X'
5    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:11    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
6        return 'X'12        return 'X'
7    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:13    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
8        return 'X'14        return 'X'
nn15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
16        return 'X'
17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
18        return 'X'
9    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
10        return 'O'20        return 'O'
n11    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:n
12        return 'O'
13    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
14        return 'O'
15    if boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
16        return 'X'
17    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
18        return 'X'
19    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
20        return 'X'
21    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:21    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
22        return 'O'22        return 'O'
23    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:23    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
24        return 'O'24        return 'O'
25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
26        return 'O'26        return 'O'
n27    if boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:n27    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
28        return 'X'28        return 'O'
29    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:29    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
30        return 'X'30        return 'O'
31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
32        return 'O'32        return 'O'
33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
34        return 'O'34        return 'O'
35    else:35    else:
n36        return'-'n36        return '-'
37    pass37    pass
38def decodeBoard(nBoard):38def decodeBoard(nBoard):
39    boardList=[]39    boardList=[]
40    nRemainder=nBoard 40    nRemainder=nBoard 
n41    for digit in range(8, -1,-1): n41    for digit in range(8,-1,-1): 
42        x = nRemainder / (3**digit)42        x = nRemainder / (3**digit)
43        x = math.floor(x)43        x = math.floor(x)
nn44        nRemainder = nRemainder - ( x * (3**digit) )
44        boardList.append(x)45        boardList.append(x)
n45        nRemainder = nRemainder - ( x * (3**digit) )n
46    return boardList46    return boardList
47if __name__=="__main__":47if __name__=="__main__":
n48    passdef countBases(seq):n48    passdef countBases(seq_a):
49     A = 049    A = 0
50     C = 050    C = 0
51     G = 051    G = 0
52     T = 052    T = 0
53     for x in seq:53    for d in seq_a:
54         if x == 'A':54        if d == 'A':
55             A += 155             A += 1
n56         elif x == 'C':n56        elif d == 'C':
57             C += 157            C += 1
58         elif x == 'G':58        elif d == 'G':
59             G += 159            G += 1
60         elif x == 'T':60        elif d == 'T':
61             T += 161            T += 1
62         else:
63             continue 
64     cg_percentage = (((C + G) / (len(seq))) * 100)62    cg_percentage = float((C + G) / ((len(seq_a))) * 100)
65     return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)63    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
66def hammingdistance(seq_a, seq_b):64def hammingdistance(seq_a, seq_b):
n67    if len(seq_a) != len(seq_b):n65    if len(seq_a) == len(seq_b):
68        return "Error: Sequences Length Mismatch"66        diff = 0
67        for i in range(len(seq_a)):
68            if seq_a[i] != seq_b[i]:
69                diff += 1
69    else:70    else:
t70        diff = 0t71        return 'Error: Sequences Length Mismatch'
71    for i in range(0, len(seq_a)):
72        if seq_a[i] != seq_b[i]:
73            diff += 1
74    return diff72    return diff
75if __name__=="__main__":73if __name__=="__main__":
76    pass74    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 34

Student ID: 10, P-Value: 2.67e-02

Nearest Neighbor ID: 370

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
n2def findWinner(boardList) :n2def findWinner(boardList):
3    for row in range(3) :3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2] :4        if boardList[row * 3] == boardList[row * 3+1] == boardList[row * 3+2]:
5            if boardList[row*3] == 1 :5            if boardList[row * 3] == 1:
6                return 'X'6                return 'X'
n7            elif boardList[row*3] == 2 :n7            elif boardList[row * 3] == 2:
8                return 'O'8                return 'O'
n9    for col in range(3) :n9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6] :10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1 :11            if boardList[col] == 1:
12                return 'X'12                return 'X'
n13            elif boardList[col] == 2 :n13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
n15    if boardList[0] == boardList[4] == boardList[8] :n15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1 :16        if boardList[0] == 1:
17            return 'X'17            return 'X'
n18        elif boardList[0] == 2 :n18        elif boardList[0] == 2:
19            return '0'19            return '0'
n20    if boardList[2] == boardList[4] == boardList[6] :n20        if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1 :21            if boardList[2] == 1:
22            return 'X'22                return 'X'
23        elif boardList[2] == 2 :23            elif boardList[2] == 2:
24            return 'O'24                return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
n28    nRemainder = nBoard  n28    nRemainder = nBoard 
29    for digit in range(8, -1, -1) :29    for digit in range(8, -1, -1):
30        x = nRemainder / (3 ** digit)30        x = nRemainder / (3 ** digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3 ** digit))32        nRemainder = nRemainder - (x * (3 ** digit))
33        boardList.append(x)33        boardList.append(x)
n34    return boardListdef countBases(seq):n34    return boardList
35def countBases(seq):
35    A, C, G, T = 0, 0, 0, 036    A, C, G, T = 0, 0, 0, 0
n36    for i in seq :n37    for i in seq:
37        if i == 'A' : A += 138        if i == 'A' : A += 1
38        if i == 'C' : C += 139        if i == 'C' : C += 1
39        if i == 'G' : G += 140        if i == 'G' : G += 1
40        if i == 'T' : T += 141        if i == 'T' : T += 1
n41    cg_percentage = (C + G) / (A + C + G + T) * 100n42    cg_percentage = (C+G)/(A+C+G+T) * 100
42    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)43    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
43def hammingdistance(seq_a, seq_b):44def hammingdistance(seq_a, seq_b):
44    if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch'45    if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch'
n45    seq_a_count = countBases(seq_a)n46    seq_a_count=countBases(seq_a)
46    seq_b_count = countBases(seq_b)47    seq_b_count=countBases(seq_b)
47    seq_a_count = seq_a_count.split(' ')48    seq_a_count=seq_a_count.split(' ')
48    seq_b_count = seq_b_count.split(' ')49    seq_b_count=seq_b_count.split(' ')
49    seq_a_count[3] = seq_a_count[3][:seq_a_count[3].index('\n')]50    seq_a_count[3]=seq_a_count[3][:seq_a_count[3].index('\n')]
50    seq_b_count[3] = seq_b_count[3][:seq_b_count[3].index('\n')]51    seq_b_count[3]=seq_b_count[3][:seq_b_count[3].index('\n')]
51    difference = 052    difference = 0
t52    for i in range(0, 4) :t53    for i in range(len(seq_a)):
53        difference += abs(int(seq_a_count[i]) - int(seq_b_count[i])) * 254        if (seq_a[i] == seq_b[i]):
55            pass
56        else:
57            difference +=1 
54    return difference58    return difference
55if __name__=="__main__":59if __name__=="__main__":
56    print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT'))60    print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT'))
57    pass61    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 35

Student ID: 370, P-Value: 2.67e-02

Nearest Neighbor ID: 10

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
n2def findWinner(boardList):n2def findWinner(boardList) :
3    for row in range(3):3    for row in range(3) :
4        if boardList[row * 3] == boardList[row * 3+1] == boardList[row * 3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2] :
5            if boardList[row * 3] == 1:5            if boardList[row*3] == 1 :
6                return 'X'6                return 'X'
n7            elif boardList[row * 3] == 2:n7            elif boardList[row*3] == 2 :
8                return 'O'8                return 'O'
n9    for col in range(3):n9    for col in range(3) :
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6] :
11            if boardList[col] == 1:11            if boardList[col] == 1 :
12                return 'X'12                return 'X'
n13            elif boardList[col] == 2:n13            elif boardList[col] == 2 :
14                return 'O'14                return 'O'
n15    if boardList[0] == boardList[4] == boardList[8]:n15    if boardList[0] == boardList[4] == boardList[8] :
16        if boardList[0] == 1:16        if boardList[0] == 1 :
17            return 'X'17            return 'X'
n18        elif boardList[0] == 2:n18        elif boardList[0] == 2 :
19            return '0'19            return '0'
n20        if boardList[2] == boardList[4] == boardList[6]:n20    if boardList[2] == boardList[4] == boardList[6] :
21            if boardList[2] == 1:21        if boardList[2] == 1 :
22                return 'X'22            return 'X'
23            elif boardList[2] == 2:23        elif boardList[2] == 2 :
24                return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
n28    nRemainder = nBoard n28    nRemainder = nBoard  
29    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1) :
30        x = nRemainder / (3 ** digit)30        x = nRemainder / (3 ** digit)
31        x = math.floor(x)31        x = math.floor(x)
32        nRemainder = nRemainder - (x * (3 ** digit))32        nRemainder = nRemainder - (x * (3 ** digit))
33        boardList.append(x)33        boardList.append(x)
n34    return boardListn34    return boardListdef countBases(seq):
35def countBases(seq):
36    A, C, G, T = 0, 0, 0, 035    A, C, G, T = 0, 0, 0, 0
n37    for i in seq:n36    for i in seq :
38        if i == 'A' : A += 137        if i == 'A' : A += 1
39        if i == 'C' : C += 138        if i == 'C' : C += 1
40        if i == 'G' : G += 139        if i == 'G' : G += 1
41        if i == 'T' : T += 140        if i == 'T' : T += 1
n42    cg_percentage = (C+G)/(A+C+G+T) * 100n41    cg_percentage = (C + G) / (A + C + G + T) * 100
43    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)42    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
44def hammingdistance(seq_a, seq_b):43def hammingdistance(seq_a, seq_b):
45    if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch'44    if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch'
n46    seq_a_count=countBases(seq_a)n45    seq_a_count = countBases(seq_a)
47    seq_b_count=countBases(seq_b)46    seq_b_count = countBases(seq_b)
48    seq_a_count=seq_a_count.split(' ')47    seq_a_count = seq_a_count.split(' ')
49    seq_b_count=seq_b_count.split(' ')48    seq_b_count = seq_b_count.split(' ')
50    seq_a_count[3]=seq_a_count[3][:seq_a_count[3].index('\n')]49    seq_a_count[3] = seq_a_count[3][:seq_a_count[3].index('\n')]
51    seq_b_count[3]=seq_b_count[3][:seq_b_count[3].index('\n')]50    seq_b_count[3] = seq_b_count[3][:seq_b_count[3].index('\n')]
52    difference = 051    difference = 0
t53    for i in range(len(seq_a)):t52    for i in range(0, 4) :
54        if (seq_a[i] == seq_b[i]):53        difference += abs(int(seq_a_count[i]) - int(seq_b_count[i])) * 2
55            pass
56        else:
57            difference +=1 
58    return difference54    return difference
59if __name__=="__main__":55if __name__=="__main__":
60    print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT'))56    print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT'))
61    pass57    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 36

Student ID: 307, P-Value: 2.88e-02

Nearest Neighbor ID: 217

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for column in range(3):3    for column in range(3):
4        if boardList[column] == boardList[column+3] == boardList[column+6]:4        if boardList[column] == boardList[column+3] == boardList[column+6]:
5            if boardList[column] == 1:5            if boardList[column] == 1:
n6                return "X"n6                return 'X'
7            elif boardList[column] == 2:7            elif boardList[column] == 2:
n8                return "O"n8                return 'O'
9    for row in range(3):9    for row in range(3):
10        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:10        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
11            if boardList[row*3] == 1:11            if boardList[row*3] == 1:
n12                return "X"n12                return 'X'
13            elif boardList[row*3] == 2:13            elif boardList[row*3] == 2:
n14                return "O"n14                return 'O'
15    if boardList[2] == boardList[4] == boardList[6]:15    if boardList[2] == boardList[4] == boardList[6]:
16        if boardList[2] == 1:16        if boardList[2] == 1:
n17            return "X"n17            return 'X'
18        elif boardList[2] == 2:18        elif boardList[2] == 2:
n19            return "O"n19            return 'O'
20    if boardList[0] == boardList[4] == boardList[8]:20    if boardList[0] == boardList[4] == boardList[8]:
21        if boardList[0] == 1:21        if boardList[0] == 1:
n22            return "X"n22            return 'X'
23        elif boardList[0] == 2:23        elif boardList[0] == 2:
n24            return "O"n24            return 'O'
25    else:
26        return "-"25    return '-'
27def decodeBoard(nBoard):26def decodeBoard(nBoard):
n28    boardList=[]n27    boardList = []
29    nRemainder=nBoard 28    nRemainder = nBoard  
30    for digit in range(8, -1, -1): 29    for digit in range(8, -1, -1):
31        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
32        x = math.floor(x)31        x = math.floor(x)
n33        nRemainder = nRemainder - ( x * (3**digit) )n32        nRemainder = nRemainder - (x * (3**digit))
34        boardList.append(x)33        boardList.append(x)
n35    return boardListn34    return boardListdef countBases(seq):
36if __name__=="__main__":
37    passdef countBases(sequence):
38    A, C, G, T = 0, 0, 0, 035     A, C, G, T = 0, 0, 0, 0
39    for i in sequence:36     for i in seq:
40        if i == "A":37         if i == "A":
41            A+= 138             A += 1
42        elif i == "G":39         elif i == "G":
43            G += 140             G += 1
44        elif i == "C":41         elif i == "C":
45            C += 142             C += 1
46        elif i == "T":43         elif i == "T":
47            T += 144             T += 1
48        else:45         else:
49            continue46             continue
50    cg_percentage = ((C + G) / len(sequence)) * 10047     cg_percentage = ((C + G) / len(seq)) * 100
51    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)48     return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
52def hammingdistance(seq_a, seq_b):49def hammingdistance(seq_a, seq_b):
n53    if len(seq_a,)!= len( seq_b):n50    if len(seq_a) != len(seq_b):
54        return"Error: Sequences Length Mismatch"51        return "Error: Sequences Length Mismatch"
55    count = 052    count = 0  
56    for i in range(len(seq_a)):53    for i in range(len(seq_a)):
57        if seq_a[i] == seq_b[i]:54        if seq_a[i] == seq_b[i]:
58            count += 155            count += 1
t59    return count -1t56    return count - 1
60if __name__=="__main__":57if __name__=="__main__":
61    pass58    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 37

Student ID: 217, P-Value: 2.88e-02

Nearest Neighbor ID: 307

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for column in range(3):3    for column in range(3):
4        if boardList[column] == boardList[column+3] == boardList[column+6]:4        if boardList[column] == boardList[column+3] == boardList[column+6]:
5            if boardList[column] == 1:5            if boardList[column] == 1:
n6                return 'X'n6                return "X"
7            elif boardList[column] == 2:7            elif boardList[column] == 2:
n8                return 'O'n8                return "O"
9    for row in range(3):9    for row in range(3):
10        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:10        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
11            if boardList[row*3] == 1:11            if boardList[row*3] == 1:
n12                return 'X'n12                return "X"
13            elif boardList[row*3] == 2:13            elif boardList[row*3] == 2:
n14                return 'O'n14                return "O"
15    if boardList[2] == boardList[4] == boardList[6]:15    if boardList[2] == boardList[4] == boardList[6]:
16        if boardList[2] == 1:16        if boardList[2] == 1:
n17            return 'X'n17            return "X"
18        elif boardList[2] == 2:18        elif boardList[2] == 2:
n19            return 'O'n19            return "O"
20    if boardList[0] == boardList[4] == boardList[8]:20    if boardList[0] == boardList[4] == boardList[8]:
21        if boardList[0] == 1:21        if boardList[0] == 1:
n22            return 'X'n22            return "X"
23        elif boardList[0] == 2:23        elif boardList[0] == 2:
n24            return 'O'n24            return "O"
25    else:
25    return '-'26        return "-"
26def decodeBoard(nBoard):27def decodeBoard(nBoard):
n27    boardList = []n28    boardList=[]
28    nRemainder = nBoard  29    nRemainder=nBoard 
29    for digit in range(8, -1, -1):30    for digit in range(8, -1, -1): 
30        x = nRemainder / (3**digit)31        x = nRemainder / (3**digit)
31        x = math.floor(x)32        x = math.floor(x)
n32        nRemainder = nRemainder - (x * (3**digit))n33        nRemainder = nRemainder - ( x * (3**digit) )
33        boardList.append(x)34        boardList.append(x)
n34    return boardListdef countBases(seq):n35    return boardList
36if __name__=="__main__":
37    passdef countBases(sequence):
35     A, C, G, T = 0, 0, 0, 038    A, C, G, T = 0, 0, 0, 0
36     for i in seq:39    for i in sequence:
37         if i == "A":40        if i == "A":
38             A += 141            A+= 1
39         elif i == "G":42        elif i == "G":
40             G += 143            G += 1
41         elif i == "C":44        elif i == "C":
42             C += 145            C += 1
43         elif i == "T":46        elif i == "T":
44             T += 147            T += 1
45         else:48        else:
46             continue49            continue
47     cg_percentage = ((C + G) / len(seq)) * 10050    cg_percentage = ((C + G) / len(sequence)) * 100
48     return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)51    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
49def hammingdistance(seq_a, seq_b):52def hammingdistance(seq_a, seq_b):
n50    if len(seq_a) != len(seq_b):n53    if len(seq_a,)!= len( seq_b):
51        return "Error: Sequences Length Mismatch"54        return"Error: Sequences Length Mismatch"
52    count = 0  55    count = 0
53    for i in range(len(seq_a)):56    for i in range(len(seq_a)):
54        if seq_a[i] == seq_b[i]:57        if seq_a[i] == seq_b[i]:
55            count += 158            count += 1
t56    return count - 1t59    return count -1
57if __name__=="__main__":60if __name__=="__main__":
58    pass61    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 38

Student ID: 119, P-Value: 3.04e-02

Nearest Neighbor ID: 64

Student (left) and Nearest Neighbor (right).


n1import math n1import math
2def findWinner(boardList):2def findWinner(boardList):
n3     if boardList[0] == boardList[1] == boardList[2]:n3    if boardList[0] == boardList[1] == boardList[2]: 
4         if boardList[0] == 1:4        if boardList[0] == 1:
5             return 'X'5            return 'X'
6         if boardList[0] == 2:6        if boardList[0] == 2:
7             return 'O'7            return 'O' 
8     elif boardList[3] == boardList[4] == boardList[5]:8    elif boardList[3] == boardList[4] == boardList[5]:
9         if boardList[3] == 1: 9        if boardList[3] == 1:
10             return 'X'10            return 'X'
11         if boardList[3] == 2: 11        if boardList[3] == 2:
12             return 'O'12            return 'O' 
13     elif boardList[6] == boardList[7] == boardList[8]:13    elif boardList[6] == boardList[7] == boardList[8]:
14         if boardList[6] == 1:14        if boardList[6] == 1:
15             return 'X'15            return 'X'
16         if boardList[6] == 2:16        if boardList[6] == 2:
17             return 'O'17            return 'O'
18     elif boardList[0] == boardList[3] == boardList[6]:18    elif boardList[0] == boardList[3] == boardList[6]:
19         if boardList[0] == 1:19        if boardList[0] == 1:
20             return 'X'20            return 'X'
21         if boardList[0] == 2:21        if boardList[0] == 2:
22             return 'O'22            return 'O'
23     elif boardList[1] == boardList[4] == boardList[7]:23    elif boardList[1] == boardList[4] == boardList[7]:
24         if boardList[1] == 1:24        if boardList[1] == 1:
25             return 'X'25            return 'X'
26         if boardList[1] == 2:26        if boardList[1] == 2:
27             return 'O'27            return 'O'
28     elif boardList[2] == boardList[5] == boardList[8]:28    elif boardList[2] == boardList[5] == boardList[8]: 
29         if boardList[2] == 1:29        if boardList[2] == 1:
30             return 'X'30            return 'X'
31         if boardList[2] == 2:31        if boardList[2] == 2:
32             return 'O'32            return 'O'
33     elif boardList[0] == boardList[4] == boardList[8]:33    elif boardList[0] == boardList[4] == boardList[8]:
34         if boardList[0] == 1:34        if boardList[0] == 1:
35             return 'X'35            return 'X'
36         if boardList[0] == 2:36        if boardList[0] == 2:
37             return 'O'  37            return 'O'
38     elif boardList[2] == boardList[4] == boardList[6]:38    elif boardList[2] == boardList[4] == boardList[6]:
39         if boardList[2] == 1:39        if boardList[2] == 1:
40             return 'X'40            return 'X'
41         if boardList[2] == 2:41        if boardList[2] == 2:
42             return 'O'42            return 'O' 
43     else:43    else:
44         return '-'44        return '-'
45pass45    pass
46def decodeBoard(nBoard):46def decodeBoard(nBoard):
47    boardList=[]47    boardList=[]
48    nRemainder=nBoard 48    nRemainder=nBoard 
n49    for digit in range(8,-1,-1): n49    for digit in range(8,-1, -1): 
50        x = nRemainder / (3**digit)50        x = nRemainder / (3**digit)
51        x = math.floor(x)51        x = math.floor(x)
52        nRemainder = nRemainder - ( x * (3**digit) )52        nRemainder = nRemainder - ( x * (3**digit) )
53        boardList.append(x)53        boardList.append(x)
54    return boardList54    return boardList
55if __name__=="__main__":55if __name__=="__main__":
nn56    pass
56    passdef countBases(seq):57def countBases(seq):
57    A, C, G, T = 0,0,0,058    A = 0
58    for j in seq:59    C = 0
60    G = 0
61    T = 0
62    for user_number in seq:
59        if j == 'A':63        if user_number == 'A':
60            A +=164            A +=1
n61        elif j == 'C':n65        elif user_number == 'C':
62            C += 66            C +=1 
63        elif j == 'G':67        elif user_number == 'G':
64            G += 1 68            G +=1
65        elif j == 'T':69        elif user_number == 'T':
66            T += 1 70            T += 1
67        else:71        else:
n68            print('Not in DNA')n72            print('Error')
69    cg_percentage = ((C+G)/len(seq))*100 73    cg_percentage = ((C+G)/len(seq))*100
70    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)74    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
71def hammingdistance(seq_a, seq_b):75def hammingdistance(seq_a, seq_b):
nn76    h_distance = 0
72    if len(seq_a) != len(seq_b):77    if len(seq_a) != len(seq_b):
n73        return 'Error: Sequences Length Mismatch'n78         return 'Error: Sequence Length Mismatch'
74    ham_distance = 0 
75    for j in range(len(seq_a)):79    for user_number in range(len(seq_a)):
76        if seq_a[j] != seq_b[j]:80        if seq_a[user_number] != seq_b[user_number]:
77            ham_distance += 1 81            h_distance += 1
78        else:82        else:
79            print('Error: Sequences Length Mismatch')83            print('Error: Sequences Length Mismatch')
t80    return ham_distancet84    return h_distance
81if __name__=="__main__":85if __name__=="__main__":
82    pass86    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 39

Student ID: 51, P-Value: 3.21e-02

Nearest Neighbor ID: 176

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
4        return 'X'4        return 'X'
n5    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:n
6        return 'X'
7    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:5    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
8        return 'X'6        return 'X'
9    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:7    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
n10        return 'X'n
11    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
12        return 'X'8        return 'X'
13    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:9    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
14        return 'X'10        return 'X'
15    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:11    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
16        return 'X'12        return 'X'
17    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:13    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
18        return 'X'14        return 'X'
nn15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
16        return 'X'
17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
18        return 'X'
19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
n20        return 'O'n
21    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
22        return 'O'20        return 'O'
23    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:21    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
24        return 'O'22        return 'O'
25    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:23    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
n26        return 'O'n
27    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
28        return 'O'24        return 'O'
29    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
30        return 'O'26        return 'O'
31    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:27    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
32        return 'O'28        return 'O'
33    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:29    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
34        return 'O'30        return 'O'
nn31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
32        return 'O'
33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
34        return 'O'
35    else:35    else:
36        return '-'36        return '-'
nn37    pass
37def decodeBoard(nBoard):38def decodeBoard(nBoard):
38    boardList=[]39    boardList=[]
n39    nRemainder = nBoard n40    nRemainder=nBoard 
40    for digit in range(8,-1,-1): 41    for digit in range(8,-1,-1): 
41        x = nRemainder / (3**digit)42        x = nRemainder / (3**digit)
42        x = math.floor(x)43        x = math.floor(x)
nn44        nRemainder = nRemainder - ( x * (3**digit) )
43        boardList.append(x)45        boardList.append(x)
n44        nRemainder = nRemainder - ( x * (3**digit) )n
45    return boardList46    return boardList
nn47if __name__=="__main__":
46def countBases(seq):48    passdef countBases(seq_a):
47    seq = list(seq)
48    A = 049    A = 0
49    C = 050    C = 0
50    G = 051    G = 0
51    T = 052    T = 0
n52    for i in range(len(seq)):n53    for d in seq_a:
53        if seq[i] == 'A':54        if d == 'A':
54            A += 155             A += 1
55        elif seq[i] == 'C':56        elif d == 'C':
56            C += 157            C += 1
n57        elif seq[i] == 'G':n58        elif d == 'G':
58            G += 159            G += 1
n59        elif seq[i] == 'T':n60        elif d == 'T':
60            T += 161            T += 1
n61    C_percentage = (C / len(seq)) * 100n62    cg_percentage = float((C + G) ((len(seq_a))) * 100)
62    G_percentage = (G / len(seq)) * 100
63    cg_percentage = C_percentage + G_percentage
64    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)63    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
65def hammingdistance(seq_a, seq_b):64def hammingdistance(seq_a, seq_b):
n66    dH = 0n
67    if len(seq_a) != len(seq_b):65    if len(seq_a) == len(seq_b):
66        diff = 0
67        for i in range(len(seq_a)):
68            if seq_a[i] != seq_b[i]:
69                diff += 1
70    else:
68        return 'Error: Sequences Length Mismatch'71        return 'Error: Sequences Length Mismatch'
t69    for i in range(len(seq_a)):t
70        if seq_a[i] != seq_b[i]:
71            dH += 1
72        else:
73            dH += 0
74    return dH72    return diff
73if __name__=="__main__":
74    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 40

Student ID: 431, P-Value: 3.57e-02

Nearest Neighbor ID: 467

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == boardList[1] == boardList[2]:3    if boardList[0] == boardList[1] == boardList[2]:
n4        if boardList[0] == 0:n
5            return '-'
6        if boardList[0] == 1:4        if boardList[0] == 1:
7            return 'X'5            return 'X'
8        if boardList[0] == 2:6        if boardList[0] == 2:
9            return 'O'7            return 'O'
10    if boardList[3] == boardList[4] == boardList[5]:8    if boardList[3] == boardList[4] == boardList[5]:
n11        if boardList[3] == 0:n
12            return '-'
13        if boardList[3] == 1:9        if boardList[3] == 1:
14            return 'X'10            return 'X'
15        if boardList[3] == 2:11        if boardList[3] == 2:
16            return 'O'12            return 'O'
17    if boardList[6] == boardList[7] == boardList[8]:13    if boardList[6] == boardList[7] == boardList[8]:
n18        if boardList[6] == 0:n
19            return '-'
20        if boardList[6] == 1:14        if boardList[6] == 1:
21            return 'X'15            return 'X'
22        if boardList[6] == 2:16        if boardList[6] == 2:
23            return 'O'17            return 'O'
24    if boardList[0] == boardList[3] == boardList[6]:18    if boardList[0] == boardList[3] == boardList[6]:
n25        if boardList[3] == 0:n
26            return '-'
27        if boardList[3] == 1:19        if boardList[0] == 1:
28            return 'X'20            return 'X'
n29        if boardList[3] == 2:n21        if boardList[0] == 2:
30            return 'O'22            return 'O'
31    if boardList[1] == boardList[4] == boardList[7]:23    if boardList[1] == boardList[4] == boardList[7]:
n32        if boardList[1] == 0:n
33            return '-'
34        if boardList[1] == 1:24        if boardList[1] == 1:
35            return 'X'25            return 'X'
36        if boardList[1] == 2:26        if boardList[1] == 2:
37            return 'O'27            return 'O'
38    if boardList[2] == boardList[5] == boardList[8]:28    if boardList[2] == boardList[5] == boardList[8]:
n39        if boardList[2] == 0:n
40            return '-'
41        if boardList[2] == 1:29        if boardList[2] == 1:
42            return 'X'30            return 'X'
43        if boardList[2] == 2:31        if boardList[2] == 2:
44            return 'O'32            return 'O'
45    if boardList[0] == boardList[4] == boardList[8]:33    if boardList[0] == boardList[4] == boardList[8]:
n46        if boardList[0] == 0:n
47            return '-'
48        if boardList[0] == 1:34        if boardList[0] == 1:
49            return 'X'35            return 'X'
50        if boardList[0] == 2:36        if boardList[0] == 2:
51            return 'O'37            return 'O'
52    if boardList[2] == boardList[4] == boardList[6]:38    if boardList[2] == boardList[4] == boardList[6]:
n53        if boardList[2] == 0:n
54            return '-'
55        if boardList[2] == 1:39        if boardList[2] == 1:
56            return 'X'40            return 'X'
57        if boardList[2] == 2:41        if boardList[2] == 2:
58            return 'O'42            return 'O'
59    return '-'43    return '-'
60def decodeBoard(nBoard):44def decodeBoard(nBoard):
61    boardList=[]45    boardList=[]
62    nRemainder=nBoard 46    nRemainder=nBoard 
n63    for digit in range(8,-1,-1): n47    for digit in range(8, -1, -1): 
64        x = nRemainder / (3**digit)48        x = nRemainder / (3**digit)
65        x = math.floor(x)49        x = math.floor(x)
66        nRemainder = nRemainder - ( x * (3**digit) )50        nRemainder = nRemainder - ( x * (3**digit) )
n67        boardList.append(x)     n51        boardList.append(x)        
68    return boardList52    return boardList
69if __name__=="__main__":53if __name__=="__main__":
70    passdef countBases(seq):54    passdef countBases(seq):
71    A = 055    A = 0
72    C = 056    C = 0
73    G = 057    G = 0
74    T = 058    T = 0
n75    for letter in seq:n59    cg_percentage = 0.0
76        if letter == "A":60    for i in range(0, len(seq)):
61        if seq[i] == 'A':
77            A += 162            A += 1
n78        if letter == "C":n63        if seq[i] == 'C':
79            C += 164            C += 1
n80        if letter == "G":n65        if seq[i] == 'G':
81            G +=166            G += 1
82        if letter == "T":67        if seq[i] == 'T':
83            T += 168            T += 1
n84    cg_percentage =((G+C) / (A+C+G+T))*100n69    cg_percentage = ((C + G) / len(seq)) * 100
85    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)70    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
86def hammingdistance(seq_a, seq_b):71def hammingdistance(seq_a, seq_b):
nn72    count = 0
87    if len(seq_a) == len(seq_b):73    if len(seq_a) != len(seq_b):
88        distance = 074        return "Error: Sequences Length Mismatch"
89        for i in range(len(seq_a)):
90            if seq_a != seq_b:
91                distance += 1
92        print(distance)
93    else:75    else:
n94        print("Error: Sequences Length Mismatch")n76        for i in range(0, len(seq_a)):
77            if seq_a[i] != seq_b[i]:
78                count += 1
79    return count
95if __name__=="__main__":80if __name__=="__main__":
t96    basecount=countBasest
97    pass81    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 41

Student ID: 250, P-Value: 3.83e-02

Nearest Neighbor ID: 467

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
n3    if boardList[0] == boardList[1] and boardList[1] == boardList [2]:n3    if boardList[0] == boardList[1] == boardList[2]:
4        if boardList[0] == 1:4        if boardList[0] == 1:
5            return 'X'5            return 'X'
6        if boardList[0] == 2:6        if boardList[0] == 2:
7            return 'O'7            return 'O'
n8        passn
9    elif boardList[3] == boardList[4] and boardList[4] == boardList [5]:8    if boardList[3] == boardList[4] == boardList[5]:
10        if boardList[3] == 1:9        if boardList[3] == 1:
11            return 'X'10            return 'X'
12        if boardList[3] == 2:11        if boardList[3] == 2:
13            return 'O'12            return 'O'
n14        passn
15    elif boardList[6] == boardList[7] and boardList[7] == boardList [8]:13    if boardList[6] == boardList[7] == boardList[8]:
16        if boardList[6] == 1:14        if boardList[6] == 1:
17            return 'X'15            return 'X'
18        if boardList[6] == 2:16        if boardList[6] == 2:
19            return 'O'17            return 'O'
n20        passn
21    elif boardList[0] == boardList[3] and boardList[3] == boardList [6]:18    if boardList[0] == boardList[3] == boardList[6]:
22        if boardList[0] == 1:19        if boardList[0] == 1:
23            return 'X'20            return 'X'
24        if boardList[0] == 2:21        if boardList[0] == 2:
25            return 'O'22            return 'O'
n26        passn
27    elif boardList[1] == boardList[4] and boardList[4] == boardList [7]:23    if boardList[1] == boardList[4] == boardList[7]:
28        if boardList[1] == 1:24        if boardList[1] == 1:
29            return 'X'25            return 'X'
30        if boardList[1] == 2:26        if boardList[1] == 2:
31            return 'O'27            return 'O'
n32        passn
33    elif boardList[2] == boardList[5] and boardList[5] == boardList [8]:28    if boardList[2] == boardList[5] == boardList[8]:
34        if boardList[2] == 1:29        if boardList[2] == 1:
35            return 'X'30            return 'X'
36        if boardList[2] == 2:31        if boardList[2] == 2:
37            return 'O'32            return 'O'
n38        passn
39    elif boardList[0] == boardList[4] and boardList[4] == boardList [8]:33    if boardList[0] == boardList[4] == boardList[8]:
40        if boardList[0] == 1:34        if boardList[0] == 1:
41            return 'X'35            return 'X'
42        if boardList[0] == 2:36        if boardList[0] == 2:
43            return 'O'37            return 'O'
n44        passn
45    elif boardList[2] == boardList[5and boardList[5] == boardList [6]:38    if boardList[2] == boardList[4== boardList[6]:
46        if boardList[2] == 1:39        if boardList[2] == 1:
47            return 'X'40            return 'X'
48        if boardList[2] == 2:41        if boardList[2] == 2:
49            return 'O'42            return 'O'
n50        passn
51    else:
52        return '-'43    return '-'
53    pass
54def decodeBoard(nBoard):44def decodeBoard(nBoard):
55    boardList=[]45    boardList=[]
56    nRemainder=nBoard 46    nRemainder=nBoard 
57    for digit in range(8, -1, -1): 47    for digit in range(8, -1, -1): 
58        x = nRemainder / (3**digit)48        x = nRemainder / (3**digit)
59        x = math.floor(x)49        x = math.floor(x)
60        nRemainder = nRemainder - ( x * (3**digit) )50        nRemainder = nRemainder - ( x * (3**digit) )
n61        boardList.append(x)n51        boardList.append(x)        
62    return boardList52    return boardList
63if __name__=="__main__":53if __name__=="__main__":
64    passdef countBases(seq):54    passdef countBases(seq):
65    A = 055    A = 0
66    C = 056    C = 0
67    G = 057    G = 0
68    T = 058    T = 0
n69    for i in seq:n59    cg_percentage = 0.0
60    for i in range(0, len(seq)):
70        if i == 'A':61        if seq[i] == 'A':
71            A += 162            A += 1
n72        elif i == 'C':n63        if seq[i] == 'C':
73            C += 164            C += 1
n74        elif i == 'G':n65        if seq[i] == 'G':
75            G += 166            G += 1
n76        elif i == 'T':n67        if seq[i] == 'T':
77            T += 168            T += 1
n78    cg_percentage = ((C + G) / (C +G + A + T)) * 100n69    cg_percentage = ((C + G) / len(seq)) * 100
79    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)70    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
80def hammingdistance(seq_a, seq_b):71def hammingdistance(seq_a, seq_b):
n81    list(seq_a)n72    count = 0
82    list(seq_b)
83    if len(seq_a) != len(seq_b):73    if len(seq_a) != len(seq_b):
84        return "Error: Sequences Length Mismatch"74        return "Error: Sequences Length Mismatch"
85    else:75    else:
t86        sim_count = 0t
87        for j in range(len(seq_a)):76        for i in range(0, len(seq_a)):
88            if seq_a[j] != seq_b [j]:77            if seq_a[i] != seq_b[i]:
89                sim_count += 178                count += 1
90    return sim_count79    return count
91if __name__=="__main__":80if __name__=="__main__":
92    pass81    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 42

Student ID: 170, P-Value: 4.10e-02

Nearest Neighbor ID: 176

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
n4        return 'X'n
5    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
6        return 'X'
7    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
8        return 'X'4        return 'X'
9    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:5    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
10        return 'X'6        return 'X'
11    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:7    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
12        return 'X'8        return 'X'
13    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:9    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
14        return 'X'10        return 'X'
nn11    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
12        return 'X'
13    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
14        return 'X'
15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
16        return 'X'16        return 'X'
n17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] ==1:n17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
18        return 'X'18        return 'X'
19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
n20        return 'O'n
21    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
22        return 'O'
23    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
24        return 'O'20        return 'O'
25    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:21    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
26        return 'O'22        return 'O'
27    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:23    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
28        return 'O'24        return 'O'
29    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
30        return 'O'26        return 'O'
nn27    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
28        return 'O'
29    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
30        return 'O'
31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
32        return 'O'32        return 'O'
n33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] ==2:n33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
34        return 'O'34        return 'O'
35    else:35    else:
36        return '-'36        return '-'
37    pass37    pass
38def decodeBoard(nBoard):38def decodeBoard(nBoard):
39    boardList=[]39    boardList=[]
40    nRemainder=nBoard 40    nRemainder=nBoard 
41    for digit in range(8,-1,-1): 41    for digit in range(8,-1,-1): 
42        x = nRemainder / (3**digit)42        x = nRemainder / (3**digit)
43        x = math.floor(x)43        x = math.floor(x)
44        nRemainder = nRemainder - ( x * (3**digit) )44        nRemainder = nRemainder - ( x * (3**digit) )
45        boardList.append(x)45        boardList.append(x)
46    return boardList46    return boardList
47if __name__=="__main__":47if __name__=="__main__":
n48    passdef countBases(seq):n48    passdef countBases(seq_a):
49    A = 049    A = 0
50    C = 050    C = 0
51    G = 051    G = 0
52    T = 052    T = 0
n53    for k in range(0,len(seq)): n53    for d in seq_a:
54        if seq[k] == "C": 54        if d == 'A':
55             A += 1
56        elif d == 'C':
55            C += 157            C += 1
n56        if seq[k] == "A":n58        elif d == 'G':
57            A += 1
58        if seq[k] == "G":
59            G += 159            G += 1
n60        if seq[k] == "T":n60        elif d == 'T':
61            T += 161            T += 1
n62    cg_percentage = C/len(seq)*100 + G/len(seq)*100 n62    cg_percentage = float((C + G) / ((len(seq_a))) * 100)
63    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)63    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
n64def hammingdistance(s, t):n64def hammingdistance(seq_aseq_b):
65    difference = 0
66    if len(s) == len(t): 65    if len(seq_a) == len(seq_b):
66        diff = 0
67        for k in range(0,len(s)): 67        for i in range(len(seq_a)):
68            if s[k] != t[k]: 68            if seq_a[i] != seq_b[i]:
69                difference += 1 69                diff += 1
70        return difference
71    else:70    else:
t72        return "Error: Sequences Length Mismatch"t71        return 'Error: Sequences Length Mismatch'
72    return diff
73if __name__=="__main__":73if __name__=="__main__":
74    pass74    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 43

Student ID: 236, P-Value: 4.31e-02

Nearest Neighbor ID: 196

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
4        return 'X'4        return 'X'
nn5    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
6        return 'O'
5    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:7    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
n6        return'X'n8        return 'X'
9    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
10        return 'O'
7    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:11    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
8        return 'X'12        return 'X'
nn13    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
14        return 'O'
9    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:15    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
10        return 'X'16        return 'X'
nn17    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
18        return 'O'
11    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:19    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
12        return 'X'20        return 'X'
nn21    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
22        return 'O'
13    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:23    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
14        return 'X'24        return 'X'
nn25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
26        return 'O'
15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:27    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
16        return 'X'28        return 'X'
nn29    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
30        return 'O'
17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:31    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
18        return 'X'32        return 'X'
n19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:n
20        return 'O'
21    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
22        return 'O'
23    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
24        return 'O'
25    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
26        return 'O'
27    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
28        return 'O'
29    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
30        return 'O'
31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
32        return 'O'
33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
34        return 'O'34        return 'O'
35    else:35    else:
36        return '-'36        return '-'
nn37    pass
37def decodeBoard(nBoard):38def decodeBoard(nBoard):
38    boardList=[]39    boardList=[]
n39    nRemainder = nBoardn40    nRemainder=nBoard 
40    for digit in range(8, -1, -1):41    for digit in range(8, -1, -1): 
41        x = nRemainder / (3**digit)42        x = nRemainder / (3**digit)
42        x = math.floor(x)43        x = math.floor(x)
43        nRemainder = nRemainder - ( x * (3**digit) )44        nRemainder = nRemainder - ( x * (3**digit) )
44        boardList.append(x)45        boardList.append(x)
45    return boardList46    return boardList
46if __name__=="__main__":47if __name__=="__main__":
47    passdef countBases(seq):48    passdef countBases(seq):
n48    A=0n49    A = 0
49    C=0
50    G=0
51    T=0
52    for r in seq:50    for i in seq:
53        if r == 'A':51        if i == 'A':
54            A = 1 + A52            A = A + 1
53    C = 0
54    for j in seq:
55        if r == 'C':55        if j == 'C':
56            C = 1 + C56            C = C + 1
57    G = 0
58    for k in seq:
57        if r == 'G':59        if k == 'G':
58            G = 1 + G60            G = G + 1
61    T = 0
62    for l in seq:
59        if r == 'T':63        if l == 'T':
60            T = 1+T64            T = T + 1
61    cg_percentage = ((G + C)/(len(seq)))*10065    cg_percentage = (C + G)/len(seq) * 100
62    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)66    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
63def hammingdistance(seq_a, seq_b):67def hammingdistance(seq_a, seq_b):
64    if len(seq_a) != len(seq_b):68    if len(seq_a) != len(seq_b):
65        return 'Error: Sequences Length Mismatch'69        return 'Error: Sequences Length Mismatch'
t66    else:t70    count = 0
67        pog = 0
68        for gaming in range(len(seq_a)):71    for in range(len(seq_a)):
69                if seq_a[gaming] != seq_b[gaming]:72        if seq_a[i] != seq_b[i]:
70                    pog += 173            count = count + 1
71        return pog74    return count
72if __name__=="__main__":75if __name__=="__main__":
73    pass76    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 44

Student ID: 164, P-Value: 4.61e-02

Nearest Neighbor ID: 196

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
nn3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
4        return 'X'
3    if boardList[0] == 2 and boardList[1] ==2 and boardList[2] == 2:5    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
4        return 'O'6        return 'O'
nn7    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
8        return 'X'
5    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:9    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
6        return 'O'10        return 'O'
nn11    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
12        return 'X'
7    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:13    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
n8        return 'O' n14        return 'O'
15    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
16        return 'X'
9    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:17    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
10        return 'O'18        return 'O'
nn19    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
20        return 'X'
11    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:21    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
12        return 'O'22        return 'O'
nn23    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
24        return 'X'
13    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
14        return 'O'26        return 'O'
nn27    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
28        return 'X'
15    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:29    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
16        return 'O'30        return 'O'
nn31    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
32        return 'X'
17    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
18        return 'O'34        return 'O'
n19    elif boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:n
20        return 'X'
21    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
22        return 'X'
23    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
24        return 'X'
25    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
26        return 'X'
27    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
28        return 'X'
29    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
30        return 'X'
31    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
32        return 'X'
33    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
34        return 'X'
35    else:35    else:
36        return '-'36        return '-'
nn37    pass
37def decodeBoard(nBoard):38def decodeBoard(nBoard):
38    boardList=[]39    boardList=[]
39    nRemainder=nBoard 40    nRemainder=nBoard 
n40    for digit in range(8,-1,-1): n41    for digit in range(8, -1, -1): 
41        x = nRemainder / (3**digit)42        x = nRemainder / (3**digit)
42        x = math.floor(x)43        x = math.floor(x)
43        nRemainder = nRemainder - ( x * (3**digit) )44        nRemainder = nRemainder - ( x * (3**digit) )
44        boardList.append(x)45        boardList.append(x)
45    return boardList46    return boardList
46if __name__=="__main__":47if __name__=="__main__":
47    passdef countBases(seq):48    passdef countBases(seq):
n48    seq = list(seq)n49    A = 0
49    A = seq.count("A")50    for i in seq:
50    C = seq.count("C")51        if i == 'A':
51    G = seq.count("G")52            A = A + 1
52    T = seq.count("T")53    C = 0
54    for j in seq:
55        if j == 'C':
56            C = C + 1
57    G = 0
58    for k in seq:
59        if k == 'G':
60            G = G + 1
61    T = 0
62    for l in seq:
63        if l == 'T':
64            T = T + 1
53    cg_percentage = (C + G)/(A + C + G + T) * 10065    cg_percentage = (C + G)/len(seq) * 100
54    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)66    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
55def hammingdistance(seq_a, seq_b):67def hammingdistance(seq_a, seq_b):
n56    if len(seq_a) is len(seq_b):n68    if len(seq_a) != len(seq_b):
57        count = 0
58        for i in range(int(len(seq_a))):
59            if seq_a[i] == seq_b[i]:
60                count = count + 1
61                ham_distance = len(seq_a) - count
62        return ham_distance
63    else:
64        return 'Error: Sequences Length Mismatch'69        return 'Error: Sequences Length Mismatch'
tt70    count = 0
71    for i in range(len(seq_a)):
72        if seq_a[i] != seq_b[i]:
73            count = count + 1
74    return count
65if __name__=="__main__":75if __name__=="__main__":
66    pass76    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 45

Student ID: 399, P-Value: 4.84e-02

Nearest Neighbor ID: 370

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
n4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:n4        if boardList[row * 3] == boardList[row * 3+1] == boardList[row * 3+2]:
5            if boardList[row*3] == 1:5            if boardList[row * 3] == 1:
6                return 'X'6                return 'X'
n7            elif boardList[row*3] == 2:n7            elif boardList[row * 3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
n17            return'X'n17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
n19            return 'O'n19            return '0'
20    if boardList[2] == boardList[4] == boardList[6]:20        if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21            if boardList[2] == 1:
22            return 'X'22                return 'X'
23        if boardList[2] == 2:23            elif boardList[2] == 2:
24            return 'O'24                return 'O'
25    return'-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
n28    nRemainder = nBoardn28    nRemainder = nBoard 
29    for digit in range(8,-1,-1):29    for digit in range(8, -1, -1):
30        x = nRemainder/(3**digit)30        x = nRemainder / (3 ** digit)
31        x = math.floor(x)31        x = math.floor(x)
n32        nRemainder = nRemainder - (x*(3**digit))n32        nRemainder = nRemainder - (x * (3 ** digit))
33        boardList.append(x)33        boardList.append(x)
n34    return boardListdef countBases(seq):n34    return boardList
35    A = seq.count("A")35def countBases(seq):
36    C = seq.count("C")36    A, C, G, T = 0, 0, 0, 0
37    G = seq.count("G")37    for i in seq:
38    T = seq.count("T")38        if i == 'A' : A += 1
39        if i == 'C' : C += 1
40        if i == 'G' : G += 1
41        if i == 'T' : T += 1
39    cg_percentage = (C + G)/(len(seq)) * 10042    cg_percentage = (C+G)/(A+C+G+T) * 100
40    return '{:d} {:d} {:d} {:d} \n{:2.1f}'.format(A, C, G, T, cg_percentage)43    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
41def hammingdistance(seq_a, seq_b):44def hammingdistance(seq_a, seq_b):
42    if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch'45    if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch'
n43    seq_a_count = countBases(seq_a)n46    seq_a_count=countBases(seq_a)
44    seq_b_count = countBases(seq_b)47    seq_b_count=countBases(seq_b)
45    seq_a_count = seq_a_count.split(' ')48    seq_a_count=seq_a_count.split(' ')
46    seq_b_count = seq_b_count.split(' ')49    seq_b_count=seq_b_count.split(' ')
47    seq_a_count[3] = seq_a_count[3][:seq_a_count[3].index('\n')]50    seq_a_count[3]=seq_a_count[3][:seq_a_count[3].index('\n')]
48    seq_b_count[3] = seq_b_count[3][:seq_b_count[3].index('\n')]51    seq_b_count[3]=seq_b_count[3][:seq_b_count[3].index('\n')]
49    difference = 0 52    difference = 0
50    for i in range(len(seq_a)):53    for i in range(len(seq_a)):
51        if (seq_a[i] == seq_b[i]):54        if (seq_a[i] == seq_b[i]):
52            pass55            pass
53        else:56        else:
n54            difference += 1n57            difference +=1 
55    return difference58    return difference
t56if __name__ == "__main__":t59if __name__=="__main__":
57    print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT'))  60    print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT'))
58    pass61    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 46

Student ID: 459, P-Value: 5.16e-02

Nearest Neighbor ID: 467

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == boardList[1] == boardList[2]:3    if boardList[0] == boardList[1] == boardList[2]:
4        if boardList[0] == 1:4        if boardList[0] == 1:
5            return 'X'5            return 'X'
n6        elif boardList[0] == 2:n6        if boardList[0] == 2:
7            return 'O'7            return 'O'
n8    elif boardList[3] == boardList[4] == boardList[5]:n8    if boardList[3] == boardList[4] == boardList[5]:
9        if boardList[3] == 1:9        if boardList[3] == 1:
10            return 'X'10            return 'X'
n11        elif boardList[3] == 2:n11        if boardList[3] == 2:
12            return 'O'12            return 'O'
n13    elif boardList[6] == boardList[7] == boardList[8]:n13    if boardList[6] == boardList[7] == boardList[8]:
14        if boardList[6] == 1:14        if boardList[6] == 1:
15            return 'X'15            return 'X'
n16        elif boardList[6] == 2:n16        if boardList[6] == 2:
17            return 'O'17            return 'O'
n18    elif boardList[0] == boardList[3] == boardList[6]:n18    if boardList[0] == boardList[3] == boardList[6]:
19        if boardList[0] == 1:19        if boardList[0] == 1:
20            return 'X'20            return 'X'
n21        elif boardList[0] == 2:n21        if boardList[0] == 2:
22            return 'O'22            return 'O'
n23    elif boardList[1] == boardList[4] == boardList[7]:n23    if boardList[1] == boardList[4] == boardList[7]:
24        if boardList[1] == 1:24        if boardList[1] == 1:
25            return 'X'25            return 'X'
n26        elif boardList[1] == 2:n26        if boardList[1] == 2:
27            return 'O'27            return 'O'
n28    elif boardList[2] == boardList[5] == boardList[8]:n28    if boardList[2] == boardList[5] == boardList[8]:
29        if boardList[2] == 1:29        if boardList[2] == 1:
30            return 'X'30            return 'X'
n31        elif boardList[2] == 2:n31        if boardList[2] == 2:
32            return 'O'32            return 'O'
n33    elif boardList[0] == boardList[4] == boardList[8]:n33    if boardList[0] == boardList[4] == boardList[8]:
34        if boardList[0] == 1:34        if boardList[0] == 1:
35            return 'X'35            return 'X'
n36        elif boardList[0] == 2:n36        if boardList[0] == 2:
37            return 'O'37            return 'O'
n38    elif boardList[2] == boardList[4] == boardList[6]:n38    if boardList[2] == boardList[4] == boardList[6]:
39        if boardList[2] == 1:39        if boardList[2] == 1:
40            return 'X'40            return 'X'
n41        elif boardList[2] == 2:n41        if boardList[2] == 2:
42            return 'O'42            return 'O'
n43    else:n
44        return '-'43    return '-'
45def decodeBoard(nBoard):44def decodeBoard(nBoard):
46    boardList=[]45    boardList=[]
47    nRemainder=nBoard 46    nRemainder=nBoard 
48    for digit in range(8, -1, -1): 47    for digit in range(8, -1, -1): 
49        x = nRemainder / (3**digit)48        x = nRemainder / (3**digit)
50        x = math.floor(x)49        x = math.floor(x)
51        nRemainder = nRemainder - ( x * (3**digit) )50        nRemainder = nRemainder - ( x * (3**digit) )
n52        boardList.append(x)n51        boardList.append(x)        
53    return boardList52    return boardList
54if __name__=="__main__":53if __name__=="__main__":
n55    a = int(input())n
56    b = decodeBoard(a)
57    findWinner(b)
58def countBases(seq):54    passdef countBases(seq):
59    A = seq.count('A')55    A = 0
60    C = seq.count('C')56    C = 0
61    G = seq.count('G')57    G = 0
62    T = seq.count('T')58    T = 0
59    cg_percentage = 0.0
60    for i in range(0, len(seq)):
61        if seq[i] == 'A':
62            A += 1
63        if seq[i] == 'C':
64            C += 1
65        if seq[i] == 'G':
66            G += 1
67        if seq[i] == 'T':
68            T += 1
63    cg_percentage = (C + G) / (A+C+G+T) * 10069    cg_percentage = ((C + G) / len(seq)) * 100
64    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)70    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
65def hammingdistance(seq_a, seq_b):71def hammingdistance(seq_a, seq_b):
n66    diff_char = 0n72    count = 0
67    if len(seq_a) != len(seq_b):73    if len(seq_a) != len(seq_b):
n68        return 'Error: Sequences Length Mismatch'n74        return "Error: Sequences Length Mismatch"
69    else:75    else:
n70        for i in range(len(seq_a)):n76        for i in range(0, len(seq_a)):
71            if seq_a[i] != seq_b[i]:77            if seq_a[i] != seq_b[i]:
n72                diff_char += 1n78                count += 1
73        return diff_char79    return count
74if __name__=="__main__":80if __name__=="__main__":
tt81    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 47

Student ID: 288, P-Value: 5.49e-02

Nearest Neighbor ID: 176

Student (left) and Nearest Neighbor (right).


nn1import math
1def findWinner(boardList):2def findWinner(boardList):
2    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
n3        return 'X'n
4    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
5        return 'X'
6    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
7        return 'X'4        return 'X'
8    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:5    elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
9        return 'X'6        return 'X'
10    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:7    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
11        return 'X'8        return 'X'
12    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:9    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
13        return 'X'10        return 'X'
nn11    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
12        return 'X'
13    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
14        return 'X'
14    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:15    elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
15        return 'X'16        return 'X'
16    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:17    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
17        return 'X'18        return 'X'
18    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:19    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
n19        return 'O'n
20    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
21        return 'O'
22    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
23        return 'O'20        return 'O'
24    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:21    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
25        return 'O'22        return 'O'
26    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:23    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
27        return 'O'24        return 'O'
28    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
29        return 'O'26        return 'O'
nn27    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
28        return 'O'
29    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
30        return 'O'
30    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
31        return 'O'32        return 'O'
32    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
33        return 'O'34        return 'O'
34    else:35    else:
35        return '-'36        return '-'
nn37    pass
36def decodeBoard(nBoard):38def decodeBoard(nBoard):
37    boardList=[]39    boardList=[]
38    nRemainder=nBoard 40    nRemainder=nBoard 
39    for digit in range(8,-1,-1): 41    for digit in range(8,-1,-1): 
40        x = nRemainder / (3**digit)42        x = nRemainder / (3**digit)
41        x = math.floor(x)43        x = math.floor(x)
42        nRemainder = nRemainder - ( x * (3**digit) )44        nRemainder = nRemainder - ( x * (3**digit) )
n43        boardList.append(x)        n45        boardList.append(x)
44    return boardList46    return boardList
n45import mathn
46if __name__=="__main__":47if __name__=="__main__":
n47    passdef countBases(seq):n48    passdef countBases(seq_a):
48     As=049    A = 0
49     Cs=050    C = 0
50     Gs=051    G = 0
51     Ts=052    T = 0
52     for _ in seq:         53    for d in seq_a:
53         if _ == 'A':54        if d == 'A':
54            As +=155             A += 1
55         elif _ == 'C':56        elif d == 'C':
56            Cs+=157            C += 1
57         elif _ == 'G':58        elif d == 'G':
58            Gs+=159            G += 1
59         elif _ == 'T':60        elif d == 'T':
60            Ts+=161            T += 1
61     cg_percentage = 100 * (Cs+Gs) / (len(seq))62    cg_percentage = float((C + G) / ((len(seq_a))) * 100)
62     return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(As, Cs, Gs, Ts, cg_percentage)63    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
63def hammingdistance(seq_a, seq_b):64def hammingdistance(seq_a, seq_b):
n64    num_diff=0n
65    if len(seq_a) != len(seq_b):65    if len(seq_a) == len(seq_b):
66        diff = 0
67        for i in range(len(seq_a)):
68            if seq_a[i] != seq_b[i]:
69                diff += 1
70    else:
66        return 'Error: Sequences Length Mismatch'71        return 'Error: Sequences Length Mismatch'
t67    else:t
68        for i in range(0,len(seq_a)):
69            if seq_a[i] != seq_b[i]:
70                num_diff+=1
71    return num_diff72    return diff
72if __name__=="__main__":73if __name__=="__main__":
73    pass74    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 48

Student ID: 374, P-Value: 7.61e-02

Nearest Neighbor ID: 30

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
n9    for column in range(3):n9    for col in range(3):
10        if boardList[column] == boardList[column + 3] == boardList[column + 6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[column] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
n13            elif boardList[column] == 2:n13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
n26    passn
27def decodeBoard(nBoard):26def decodeBoard(nBoard):
n28    boardList=[]n27    boardList = []
29    nRemainder=nBoard 28    nRemainder = nBoard  
30    for digit in range(8, -1, -1):29    for digit in range(8, -1, -1):
31        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
32        x = math.floor(x)31        x = math.floor(x)
n33        nRemainder = nRemainder - ( x * (3**digit) )n32        nRemainder = nRemainder - (x * (3**digit))
34        boardList.append(x)33        boardList.append(x)
35    return boardList34    return boardList
36if __name__=="__main__":35if __name__=="__main__":
n37    testing = decodeBoard(1607)n
38    print(testing)
39    print(findWinner(testing))
40    passdef countBases(seq):36    passdef countBases(seq):
41    A = 037    A = 0
42    C = 038    C = 0
43    G = 039    G = 0
44    T = 040    T = 0
n45    cg_percentage = 0n
46    for i in range(len(seq)):41    for n in range(len(seq)):
47        if seq[i] == 'A':42        if seq[n] == 'A':
48            A += 143            A += 1
n49        elif seq[i] == 'C':n44        elif seq[n] == 'C':
50            C += 145            C += 1
n51        elif seq[i] == 'G':n46        elif seq[n] == 'G':
52            G += 147            G += 1
n53        elif seq[i] == 'T':n48        elif seq[n] == 'T':
54            T += 149            T += 1
n55    cg_percentage = (C + G)/(A+C+G+T) * 100 n50    cg_percentage = (C + G) / len(seq) * 100
56    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)51    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
57def hammingdistance(seq_a, seq_b):52def hammingdistance(seq_a, seq_b):
n58    dif_sym = 0 n53    diff = 0
59    if len(seq_a) == len(seq_b):54    if len(seq_a) == len(seq_b):
60        for i in range(len(seq_a)):55        for i in range(len(seq_a)):
61            if seq_a[i] != seq_b[i]:56            if seq_a[i] != seq_b[i]:
n62                dif_sym += 1n57                diff += 1
63            else:58        return diff
64                continue
65    else:59    else:
66        return 'Error: Sequences Length Mismatch'60        return 'Error: Sequences Length Mismatch'
t67    return dif_symt
68    if __name__=="__main__":61if __name__=="__main__":
69        pass62    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 49

Student ID: 323, P-Value: 7.61e-02

Nearest Neighbor ID: 273

Student (left) and Nearest Neighbor (right).


n1import math n1import math
2def findWinner(boardList):2def findWinner(boardList):
n3    if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[2:9:3n3    if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[1:8:3
>]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardList[3:6:1]==[1,1,1] or boardLis>]==[1,1,1] or boardList[2:9:3]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardLis
>t[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or boardList[2:7:2]==[1,1,1]:>t[3:6:1]==[1,1,1] or boardList[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or b
 >oardList[2:7:2]==[1,1,1]:
4        return 'X'4        return 'X' 
5    elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[2:95    elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[1:8
>:3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardList[3:6:1]==[2,2,2] or boardL>:3]==[2,2,2] or boardList[2:9:3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardL
>ist[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or boardList[2:7:2]==[2,2,2]:>ist[3:6:1]==[2,2,2] or boardList[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or
 > boardList[2:7:2]==[2,2,2]:
6        return 'O'6        return 'O'
n7    else:n7    else: 
8        return '-'8        return '-'
n9        pass n
10    pass9    pass
11def decodeBoard(nBoard):10def decodeBoard(nBoard):
12    boardList=[]11    boardList=[]
n13    nRemainder=nBoard n12    nRemainder=int(nBoard
14    for digit in range(8,-1,-1): 13    for digit in range(8,-1,-1): 
15        x = nRemainder / (3**digit)14        x = nRemainder / (3**digit)
16        x = math.floor(x)15        x = math.floor(x)
17        nRemainder = nRemainder - ( x * (3**digit) )16        nRemainder = nRemainder - ( x * (3**digit) )
n18        boardList.append(x)n17        boardList.append(x)   
19    return boardList18    return boardList
20if __name__=="__main__":19if __name__=="__main__":
21    passdef countBases(seq):20    passdef countBases(seq):
22    A = 021    A = 0
23    C = 022    C = 0
24    G = 023    G = 0
25    T = 0 24    T = 0 
n26    for s in range(0,len(seq)):n25    for n in range(0,len(seq)):
27         if seq[s] == 'A':26        if seq[n]=='A':
28             A+=127            A = A+1
29         elif seq[s] == 'C':28        elif seq[n]=='C':
30             C+=129            C = C+1
31         elif seq[s] == 'G':30        elif seq[n]=='G':
32             G+=131            G = G+1
33         elif seq[s] == 'T':32        elif seq[n]=='T':
34             T+=133            T = T+1
35    else:
36            pass
37    cg_percentage = (100*(C+G))/(len(seq))34    cg_percentage = 100*((C+G)/(len(seq))
38    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)35    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
39def hammingdistance(seq_a, seq_b):36def hammingdistance(seq_a, seq_b):
n40    if len(seq_a) == len(seq_b):n37    if len(seq_a)==len(seq_b):
41       count = -138        count = -1
42       for i in range (0,len(seq_a)):39        for i in range(0,len(seq_a)):
43           if seq_a[i] == seq_b[i]:40            if seq_a[i]==seq_b[i]:
44              count +141                count = count+1
45       return count42        return count
46    else: 
47       return 'Error: Sequences Length Mismatch'
48    if __name__=="__main__":
49         basecount=countBases(seq_a,seq_b)
50    else:43    else:
tt44        return 'Error: Sequences Length Mismatch'
45if __name__=="__main__":
51         pass46    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 50

Student ID: 172, P-Value: 7.71e-02

Nearest Neighbor ID: 30

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
n3    for row in range(3) :n3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
n19            return '0'n19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
27    boardList = []27    boardList = []
n28    nRemainder = nBoard n28    nRemainder = nBoard  
29    for digit in range(8, -1, -1): 29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
n32        nRemainder = nRemainder - ( x * (3**digit) )n32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)33        boardList.append(x)
34    return boardList34    return boardList
nn35if __name__=="__main__":
35def countBases(seq):36    passdef countBases(seq):
36    A = 037    A = 0
37    C = 038    C = 0
38    G = 039    G = 0
39    T = 040    T = 0
n40    for i in seq :n41    for n in range(len(seq)):
41        if i == 'A': 42        if seq[n] == 'A':
42            A += 143            A += 1
n43        elif i == 'C':n44        elif seq[n] == 'C':
44            C += 145            C += 1
n45        elif i == 'G':n46        elif seq[n] == 'G':
46            G += 147            G += 1
n47        else:n48        elif seq[n] == 'T':
48            T += 149            T += 1
n49    cg_percentage = ((C + G) / (len(seq))) * 100n50    cg_percentage = (C + G) / len(seq) * 100
50    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)51    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
51def hammingdistance(seq_a, seq_b):52def hammingdistance(seq_a, seq_b):
nn53    diff = 0
52    if len(seq_a) != len(seq_b):54    if len(seq_a) == len(seq_b):
55        for i in range(len(seq_a)):
56            if seq_a[i] != seq_b[i]:
57                diff += 1
58        return diff
59    else:
53        return 'Error: Sequences Length Mismatch'60        return 'Error: Sequences Length Mismatch'
n54    distance = 0n
55    L = len(seq_a)
56    for i in range(L):
57        if seq_a[i] != seq_b[i]:
58            distance += 1
59    return distance
60if __name__=="__main__":61if __name__=="__main__":
t61   print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT'))t
62   pass62    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 51

Student ID: 287, P-Value: 7.93e-02

Nearest Neighbor ID: 398

Student (left) and Nearest Neighbor (right).


n1import mathn1import math 
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == boardList[1] == boardList[2] == 1:3    if boardList[0] == boardList[1] == boardList[2] == 1:
n4        return ('X')n4        return 'X'
5    elif boardList[0] == boardList[1] == boardList[2] == 2:
6        return ('O')
7    elif boardList[3] == boardList[4] == boardList[5] == 1:5    elif boardList[3] == boardList[4] == boardList[5] == 1:
n8        return ('X')n6        return 'X'
7    elif boardList[6] == boardList[7] == boardList[8] == 1:
8        return 'X'
9    elif boardList[0] == boardList[3] == boardList[6] == 1:
10        return 'X'
11    elif boardList[1] == boardList[4] == boardList[7] == 1:
12        return 'X'
13    elif boardList[2] == boardList[5] == boardList[8] == 1:
14        return 'X'
15    elif boardList[0] == boardList[4] == boardList[8] == 1:
16        return 'X'
17    elif boardList[2] == boardList[4] == boardList[6] == 1:
18        return 'X'
19    if boardList[0] == boardList[1] == boardList[2] == 2:
20        return 'O'
9    elif boardList[3] == boardList[4] == boardList[5] == 2:21    elif boardList[3] == boardList[4] == boardList[5] == 2:
n10        return ('O')n22        return 'O'
11    elif boardList[6] == boardList[7] == boardList[8] == 1:
12        return ('X')
13    elif boardList[6] == boardList[7] == boardList[8] == 2:23    elif boardList[6] == boardList[7] == boardList[8] == 2:
n14        return ('O')n24        return 'O'
15    elif boardList[0] == boardList[3] == boardList[6] == 1:
16        return ('X')
17    elif boardList[0] == boardList[3] == boardList[6] == 2:25    elif boardList[0] == boardList[3] == boardList[6] == 2:
n18        return ('O')n26        return 'O'
19    elif boardList[1] == boardList[4] == boardList[7] == 1:
20        return ('X')
21    elif boardList[1] == boardList[4] == boardList[7] == 2:27    elif boardList[1] == boardList[4] == boardList[7] == 2:
n22        return ('O')n28        return 'O'
23    elif boardList[2] == boardList[5] == boardList[8] == 1:
24        return ('X')
25    elif boardList[2] == boardList[5] == boardList[8] == 2:29    elif boardList[2] == boardList[5] == boardList[8] == 2:
n26        return ('O')n30        return 'O'
27    elif boardList[0] == boardList[4] == boardList[8] == 1:
28        return ('X')
29    elif boardList[0] == boardList[4] == boardList[8] == 2:31    elif boardList[0] == boardList[4] == boardList[8] == 2:
n30        return ('O')n32        return 'O'
31    elif boardList[2] == boardList[4] == boardList[6] == 1:
32        return ('X')
33    elif boardList[2] == boardList[4] == boardList[6] == 2:33    elif boardList[2] == boardList[4] == boardList[6] == 2:
n34        return ('O')n34        return 'O'
35    else:35    else:
n36        return ('-')n36        return '-'
37def decodeBoard(nBoard):37def decodeBoard(nBoard):
38    boardList=[]38    boardList=[]
n39    nRemainder=nBoardn39    nRemainder=nBoard 
40    for digit in reversed(range(0,8+1)):40    for digit in range(8,-1,-1): 
41        x = nRemainder / (3**digit)41        x = nRemainder / (3**digit)
42        x = math.floor(x)42        x = math.floor(x)
43        nRemainder = nRemainder - ( x * (3**digit) )43        nRemainder = nRemainder - ( x * (3**digit) )
44        boardList.append(x)44        boardList.append(x)
45    return boardList45    return boardList
46if __name__=="__main__":46if __name__=="__main__":
n47    print()n47    print(findWinner)
48    passdef countBases(seq):48    passdef countBases(seq):
49    A = seq.count('A')49    A = seq.count('A')
50    C = seq.count('C')50    C = seq.count('C')
51    G = seq.count('G')51    G = seq.count('G')
52    T = seq.count('T')52    T = seq.count('T')
n53    cg_percentage = float(((C + G) / len(seq))*100)n53    cg_percentage = ((C + G) / len(seq)) * 100
54    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)54    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
55def hammingdistance(seq_a, seq_b):55def hammingdistance(seq_a, seq_b):
n56    if len(seq_a) != len(seq_b):n56    if len(seq_b) != len(seq_a):
57        return("Error: Sequences Length Mismatch")57        return("Error: Sequences Length Mismatch")
t58    if len(seq_a) == len(seq_b):t58    else:
59        difference = 059        return sum(seq_a[i] != seq_b[i] for i in range(len(seq_a)))
60        for i in range(len(seq_a)):60if __name__=="__main__":
61            if seq_a[i] != seq_b[i]:61    print(countBases)
62                difference += 162    pass
63        return difference
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 52

Student ID: 398, P-Value: 7.93e-02

Nearest Neighbor ID: 287

Student (left) and Nearest Neighbor (right).


n1import math n1import math
2def findWinner(boardList):2def findWinner(boardList):
3    if boardList[0] == boardList[1] == boardList[2] == 1:3    if boardList[0] == boardList[1] == boardList[2] == 1:
n4        return 'X'n4        return ('X')
5    elif boardList[0] == boardList[1] == boardList[2] == 2:
6        return ('O')
5    elif boardList[3] == boardList[4] == boardList[5] == 1:7    elif boardList[3] == boardList[4] == boardList[5] == 1:
n6        return 'X'n8        return ('X')
9    elif boardList[3] == boardList[4] == boardList[5] == 2:
10        return ('O')
7    elif boardList[6] == boardList[7] == boardList[8] == 1:11    elif boardList[6] == boardList[7] == boardList[8] == 1:
n8        return 'X'n12        return ('X')
13    elif boardList[6] == boardList[7] == boardList[8] == 2:
14        return ('O')
9    elif boardList[0] == boardList[3] == boardList[6] == 1:15    elif boardList[0] == boardList[3] == boardList[6] == 1:
n10        return 'X'n16        return ('X')
17    elif boardList[0] == boardList[3] == boardList[6] == 2:
18        return ('O')
11    elif boardList[1] == boardList[4] == boardList[7] == 1:19    elif boardList[1] == boardList[4] == boardList[7] == 1:
n12        return 'X'n20        return ('X')
21    elif boardList[1] == boardList[4] == boardList[7] == 2:
22        return ('O')
13    elif boardList[2] == boardList[5] == boardList[8] == 1:23    elif boardList[2] == boardList[5] == boardList[8] == 1:
n14        return 'X'n24        return ('X')
25    elif boardList[2] == boardList[5] == boardList[8] == 2:
26        return ('O')
15    elif boardList[0] == boardList[4] == boardList[8] == 1:27    elif boardList[0] == boardList[4] == boardList[8] == 1:
n16        return 'X'n28        return ('X')
29    elif boardList[0] == boardList[4] == boardList[8] == 2:
30        return ('O')
17    elif boardList[2] == boardList[4] == boardList[6] == 1:31    elif boardList[2] == boardList[4] == boardList[6] == 1:
n18        return 'X'n32        return ('X')
19    if boardList[0] == boardList[1] == boardList[2] == 2:
20        return 'O'
21    elif boardList[3] == boardList[4] == boardList[5] == 2:
22        return 'O'
23    elif boardList[6] == boardList[7] == boardList[8] == 2:
24        return 'O'
25    elif boardList[0] == boardList[3] == boardList[6] == 2:
26        return 'O'
27    elif boardList[1] == boardList[4] == boardList[7] == 2:
28        return 'O'
29    elif boardList[2] == boardList[5] == boardList[8] == 2:
30        return 'O'
31    elif boardList[0] == boardList[4] == boardList[8] == 2:
32        return 'O'
33    elif boardList[2] == boardList[4] == boardList[6] == 2:33    elif boardList[2] == boardList[4] == boardList[6] == 2:
n34        return 'O'n34        return ('O')
35    else:35    else:
n36        return '-'n36        return ('-')
37def decodeBoard(nBoard):37def decodeBoard(nBoard):
38    boardList=[]38    boardList=[]
n39    nRemainder=nBoard n39    nRemainder=nBoard
40    for digit in range(8,-1,-1): 40    for digit in reversed(range(0,8+1)):
41        x = nRemainder / (3**digit)41        x = nRemainder / (3**digit)
42        x = math.floor(x)42        x = math.floor(x)
43        nRemainder = nRemainder - ( x * (3**digit) )43        nRemainder = nRemainder - ( x * (3**digit) )
44        boardList.append(x)44        boardList.append(x)
45    return boardList45    return boardList
46if __name__=="__main__":46if __name__=="__main__":
n47    print(findWinner)n47    print()
48    passdef countBases(seq):48    passdef countBases(seq):
49    A = seq.count('A')49    A = seq.count('A')
50    C = seq.count('C')50    C = seq.count('C')
51    G = seq.count('G')51    G = seq.count('G')
52    T = seq.count('T')52    T = seq.count('T')
n53    cg_percentage = ((C + G) / len(seq)) * 100n53    cg_percentage = float(((C + G) / len(seq))*100)
54    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)54    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
55def hammingdistance(seq_a, seq_b):55def hammingdistance(seq_a, seq_b):
n56    if len(seq_b) != len(seq_a):n56    if len(seq_a) != len(seq_b):
57        return("Error: Sequences Length Mismatch")57        return("Error: Sequences Length Mismatch")
t58    else:t58    if len(seq_a) == len(seq_b):
59        return sum(seq_a[i] != seq_b[i] for i in range(len(seq_a)))59        difference = 0
60if __name__=="__main__":60        for i in range(len(seq_a)):
61    print(countBases)61            if seq_a[i] != seq_b[i]:
62    pass62                difference += 1
63        return difference
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 53

Student ID: 145, P-Value: 8.85e-02

Nearest Neighbor ID: 459

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
n3    if boardList[0] == boardList[1] and boardList[1] == boardList[2]:n3    if boardList[0] == boardList[1] == boardList[2]:
4        if boardList[0] == 1:4        if boardList[0] == 1:
5            return 'X'5            return 'X'
6        elif boardList[0] == 2:6        elif boardList[0] == 2:
n7            return '0'n7            return 'O'
8    if boardList[3] == boardList[4] and boardList[4] == boardList[5]: 8    elif boardList[3] == boardList[4] == boardList[5]:
9        if boardList[3] == 1:9        if boardList[3] == 1:
10            return 'X'10            return 'X'
11        elif boardList[3] == 2:11        elif boardList[3] == 2:
12            return 'O'12            return 'O'
n13    if boardList[6] == boardList[7] and boardList[7] == boardList[8]:n13    elif boardList[6] == boardList[7] == boardList[8]:
14        if boardList[6] == 1:14        if boardList[6] == 1:
15            return 'X'15            return 'X'
16        elif boardList[6] == 2:16        elif boardList[6] == 2:
17            return 'O'17            return 'O'
n18    if boardList[0] == boardList[3] and boardList[3] == boardList[6]: n18    elif boardList[0] == boardList[3] == boardList[6]:
19        if boardList[0] == 1:19        if boardList[0] == 1:
20            return 'X'20            return 'X'
21        elif boardList[0] == 2:21        elif boardList[0] == 2:
22            return 'O'22            return 'O'
n23    if boardList[1] == boardList[4] and boardList[4] == boardList[7]: n23    elif boardList[1] == boardList[4] == boardList[7]:
24        if boardList[1] == 1:24        if boardList[1] == 1:
25            return 'X'25            return 'X'
26        elif boardList[1] == 2:26        elif boardList[1] == 2:
27            return 'O'27            return 'O'
n28    if boardList[2] == boardList[5] and boardList[5] == boardList[8]: n28    elif boardList[2] == boardList[5] == boardList[8]:
29        if boardList[2] == 1:29        if boardList[2] == 1:
30            return 'X'30            return 'X'
31        elif boardList[2] == 2:31        elif boardList[2] == 2:
32            return 'O'32            return 'O'
n33    if boardList[0] == boardList[4] and boardList[4] == boardList[8]: n33    elif boardList[0] == boardList[4] == boardList[8]:
34        if boardList[0] == 1:34        if boardList[0] == 1:
35            return 'X'35            return 'X'
36        elif boardList[0] == 2:36        elif boardList[0] == 2:
37            return 'O'37            return 'O'
n38    if boardList[2] == boardList[4] and boardList[4] == boardList[6]: n38    elif boardList[2] == boardList[4] == boardList[6]:
39        if boardList[2] == 1:39        if boardList[2] == 1:
40            return 'X'40            return 'X'
41        elif boardList[2] == 2:41        elif boardList[2] == 2:
42            return 'O'42            return 'O'
43    else:43    else:
n44        return("-")n44        return '-'
45    pass
46def decodeBoard(nBoard):45def decodeBoard(nBoard):
47    boardList=[]46    boardList=[]
n48    nRemainder = nBoard n47    nRemainder=nBoard 
49    for digit in range(8,-1,-1): 48    for digit in range(8, -1, -1): 
50        x = nRemainder / (3**digit)49        x = nRemainder / (3**digit)
51        x = math.floor(x)50        x = math.floor(x)
52        nRemainder = nRemainder - ( x * (3**digit) )51        nRemainder = nRemainder - ( x * (3**digit) )
53        boardList.append(x)52        boardList.append(x)
54    return boardList53    return boardList
55if __name__=="__main__":54if __name__=="__main__":
nn55    a = int(input())
56    b = decodeBoard(a)
57    findWinner(b)
56    passdef countBases(seq):58def countBases(seq):
57    A = seq.count('A')59    A = seq.count('A')
58    C = seq.count('C')60    C = seq.count('C')
59    G = seq.count('G')61    G = seq.count('G')
60    T = seq.count('T')62    T = seq.count('T')
n61    cg_percentage = ((C + G)/len(seq)) * 100n63    cg_percentage = (C + G) / (A+C+G+T) * 100
62    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)64    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
63def hammingdistance(seq_a, seq_b):65def hammingdistance(seq_a, seq_b):
nn66    diff_char = 0
64    if len(seq_a) != len(seq_b):67    if len(seq_a) != len(seq_b):
65        return 'Error: Sequences Length Mismatch'68        return 'Error: Sequences Length Mismatch'
n66    char_count = 0 n69    else:
67    if len(seq_a) == len(seq_b):
68        char_count = 0 
69        length = len(seq_a)
70        for char in range(length):70        for i in range(len(seq_a)):
71            if seq_a[char] != seq_b[char]:71            if seq_a[i] != seq_b[i]:
72                char_count += 172                diff_char += 1
73    return (char_count)73        return diff_char
74    print(char_count)
75if __name__=="__main__":74if __name__=="__main__":
t76    passt
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 54

Student ID: 192, P-Value: 9.45e-02

Nearest Neighbor ID: 37

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
3    for row in range(3):3    for row in range(3):
4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:4        if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]:
5            if boardList[row*3] == 1:5            if boardList[row*3] == 1:
6                return 'X'6                return 'X'
7            elif boardList[row*3] == 2:7            elif boardList[row*3] == 2:
8                return 'O'8                return 'O'
9    for col in range(3):9    for col in range(3):
10        if boardList[col] == boardList[col+3] == boardList[col+6]:10        if boardList[col] == boardList[col+3] == boardList[col+6]:
11            if boardList[col] == 1:11            if boardList[col] == 1:
12                return 'X'12                return 'X'
13            elif boardList[col] == 2:13            elif boardList[col] == 2:
14                return 'O'14                return 'O'
15    if boardList[0] == boardList[4] == boardList[8]:15    if boardList[0] == boardList[4] == boardList[8]:
16        if boardList[0] == 1:16        if boardList[0] == 1:
17            return 'X'17            return 'X'
18        elif boardList[0] == 2:18        elif boardList[0] == 2:
19            return 'O'19            return 'O'
20    if boardList[2] == boardList[4] == boardList[6]:20    if boardList[2] == boardList[4] == boardList[6]:
21        if boardList[2] == 1:21        if boardList[2] == 1:
22            return 'X'22            return 'X'
23        elif boardList[2] == 2:23        elif boardList[2] == 2:
24            return 'O'24            return 'O'
25    return '-'25    return '-'
26def decodeBoard(nBoard):26def decodeBoard(nBoard):
n27    boardList=[]n27    boardList = []
28    nRemainder=nBoard 28    nRemainder = nBoard  
29    for digit in range(8,-1,-1): 29    for digit in range(8, -1, -1):
30        x = nRemainder / (3**digit)30        x = nRemainder / (3**digit)
31        x = math.floor(x)31        x = math.floor(x)
n32        nRemainder = nRemainder - ( x * (3**digit) )n32        nRemainder = nRemainder - (x * (3**digit))
33        boardList.append(x)    33        boardList.append(x)
34    return boardList34    return boardListdef  countBases(seq):
35def countBases(seq):
36    numA = seq.count('A')35    A = str(seq).count('A')
37    numC = seq.count('C')
38    numG = seq.count('G')
39    numT = seq.count('T')36    T = str(seq).count('T')
40    cg_percentage = (numC + numG)/(numA + numC + numG + numT)*10037    C = str(seq).count('C')
38    G = str(seq).count('G')
39    cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100)
41    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(numA, numC, numG, numT, cg_perc40    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
>entage) 
42def hammingdistance(seq_a, seq_b):41def hammingdistance(seq_a, seq_b):
nn42    s= seq_a
43    t= seq_b
44    count=0
45    for i in range(len(s)):
46        if s[i]!= t[i]:
47            count+=1
43    if len(seq_a) != len(seq_b):48    if len(seq_a) != len(seq_b):
44        return "Error: Sequences Length Mismatch"49        return "Error: Sequences Length Mismatch"
45    else:50    else:
t46        seq_a = set(seq_a)t51        return count
47        seq_b = set(seq_b)
48        diff = seq_a.symmetric_difference(seq_b)
49        len_diff = seq_a.difference(seq_b)
50        return len(len_diff)+7
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 55

Student ID: 159, P-Value: 9.70e-02

Nearest Neighbor ID: 467

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
n3    x = ''n
4    if boardList[0] == boardList[1] == boardList[2]:3    if boardList[0] == boardList[1] == boardList[2]:
n5        x = boardList[0]n4        if boardList[0] == 1:
5            return 'X'
6        if boardList[0] == 2:
7            return 'O'
6    elif boardList[3] == boardList[4] == boardList[5]:8    if boardList[3] == boardList[4] == boardList[5]:
7        x = boardList[3]9        if boardList[3] == 1:
10            return 'X'
11        if boardList[3] == 2:
12            return 'O'
8    elif boardList[6] == boardList[7] == boardList[8]:13    if boardList[6] == boardList[7] == boardList[8]:
9        x = boardList[6]14        if boardList[6] == 1:
15            return 'X'
16        if boardList[6] == 2:
17            return 'O'
10    elif boardList[0] == boardList[3] == boardList[6]:18    if boardList[0] == boardList[3] == boardList[6]:
11        x = boardList[0]19        if boardList[0] == 1:
20            return 'X'
21        if boardList[0] == 2:
22            return 'O'
12    elif boardList[1] == boardList[4] == boardList[7]:23    if boardList[1] == boardList[4] == boardList[7]:
13        x = boardList[1]24        if boardList[1] == 1:
25            return 'X'
26        if boardList[1] == 2:
27            return 'O'
14    elif boardList[2] == boardList[5] == boardList[8]:28    if boardList[2] == boardList[5] == boardList[8]:
15        x = boardList[2]29        if boardList[2] == 1:
30            return 'X'
31        if boardList[2] == 2:
32            return 'O'
16    elif boardList[0] == boardList[4] == boardList[8]:33    if boardList[0] == boardList[4] == boardList[8]:
17        x = boardList[0]34        if boardList[0] == 1:
35            return 'X'
36        if boardList[0] == 2:
37            return 'O'
18    elif boardList[2] == boardList[4] == boardList[6]:38    if boardList[2] == boardList[4] == boardList[6]:
19        x = boardList[2]39        if boardList[2] == 1:
20    else:40            return 'X'
21        x = '-'41        if boardList[2] == 2:
22    if x == 0:42            return 'O'
23        x = '-'
24    elif x == 1:
25        x = 'X'
26    elif x == 2:
27        x = 'O' 
28    return 43    return '-'
29def decodeBoard(nBoard):44def decodeBoard(nBoard):
30    boardList=[]45    boardList=[]
31    nRemainder=nBoard 46    nRemainder=nBoard 
n32    for digit in range(8,-1,-1): n47    for digit in range(8, -1, -1): 
33        x = nRemainder / (3**digit)48        x = nRemainder / (3**digit)
34        x = math.floor(x)49        x = math.floor(x)
35        nRemainder = nRemainder - ( x * (3**digit) )50        nRemainder = nRemainder - ( x * (3**digit) )
n36        boardList.append(x) n51        boardList.append(x)        
37    return boardList52    return boardList
38if __name__=="__main__":53if __name__=="__main__":
39    passdef countBases(seq):54    passdef countBases(seq):
40    A = 055    A = 0
41    C = 056    C = 0
42    G = 057    G = 0
43    T = 058    T = 0
n44    for i in seq:n59    cg_percentage = 0.0
60    for i in range(0, len(seq)):
45        if i == 'A':61        if seq[i] == 'A':
46            A += 162            A += 1
n47        elif i == 'C':n63        if seq[i] == 'C':
48            C += 164            C += 1
n49        elif i == 'G':n65        if seq[i] == 'G':
50            G += 1   66            G += 1
51        elif i == 'T':67        if seq[i] == 'T':
52            T += 1 68            T += 1
53    cg_percentage = ((C + G)/len(seq))*10069    cg_percentage = ((C + G) / len(seq)) * 100
54    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)70    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
55def hammingdistance(seq_a, seq_b):71def hammingdistance(seq_a, seq_b):
n56    x = 0n72    count = 0
57    if len(seq_a) == len(seq_b):73    if len(seq_a) != len(seq_b):
74        return "Error: Sequences Length Mismatch"
75    else:
58        for i in range(len(seq_a)):76        for i in range(0, len(seq_a)):
59            if seq_a[i] != seq_b[i]:77            if seq_a[i] != seq_b[i]:
n60                x += 1n78                count += 1
61    else:
62        x = "Error: Sequences Length Mismatch"
63    return x79    return count
64if __name__=="__main__":80if __name__=="__main__":
t65    seq = input()t
66    seq_a = input()
67    seq_b = input()
68    print(countBases(seq))
69    print(hammingdistance(seq_a, seq_b))
70    pass81    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 56

Student ID: 405, P-Value: 9.82e-02

Nearest Neighbor ID: 63

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
2def findWinner(boardList):2def findWinner(boardList):
nn3    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:
4        return 'X'
5    elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:
6        return 'X'
7    elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
8        return 'X'
9    elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
10        return 'O'
11    elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:
12        return 'O'
13    elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
14        return 'O'
3    if boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:15    if boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1:
n4        return 'X' n
5    if boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
6        return 'X' 
7    if boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
8        return 'X'16        return 'X'
n9    if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1:n
10        return 'X'   
11    if boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1:17    elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1:
12        return 'X' 
13    if boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1:
14        return 'X'   
15    if boardList[6] == 1 and boardList[4] == 1 and boardList[2] == 1:
16        return 'X'18        return 'X'
nn19    elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1:
20        return 'X'
21    elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:
22        return 'O'
23    elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:
24        return 'O'
25    elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
26        return 'O'
17    if boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:27    if boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1:
n18        return 'X' n28        return 'X'
29    elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1:
30        return 'X'
19    if boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2:31    elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
20        return 'O'32        return 'O'
n21    if boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2:n33    elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2:
22        return 'O'   
23    if boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2:
24        return 'O' 
25    if boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2:
26        return 'O'34        return 'O'
n27    if boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2:n35    else:
28        return 'O'36        return'-'
29    if boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2:
30        return 'O'  
31    if boardList[6] == 2 and boardList[4] == 2 and boardList[2] == 2:
32        return 'O'  
33    if boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2:
34        return 'O'  
35    return '-'   
36    pass37    pass
37def decodeBoard(nBoard):38def decodeBoard(nBoard):
38    boardList=[]39    boardList=[]
39    nRemainder=nBoard 40    nRemainder=nBoard 
n40    for digit in range(8, -1, -1): n41    for digit in range(8, -1,-1): 
41        x = nRemainder / (3**digit)42        x = nRemainder / (3**digit)
42        x = math.floor(x)43        x = math.floor(x)
nn44        boardList.append(x)
43        nRemainder = nRemainder - ( x * (3**digit) )45        nRemainder = nRemainder - ( x * (3**digit) )
n44        boardList.append(x)n
45    return boardList46    return boardList
46if __name__=="__main__":47if __name__=="__main__":
47    passdef countBases(seq):48    passdef countBases(seq):
n48     A = C = G = T = 0n49     A = 0
49     for i in range(0,len(seq)):50     C = 0
51     G = 0
52     T = 0
53     for x in seq:
50        if seq[i] == 'A':54         if x == 'A':
51            A += 155             A += 1
52        elif seq[i] == 'C':56         elif x == 'C':
53            C += 157             C += 1
54        elif seq[i] == 'G':58         elif x == 'G':
55            G += 159             G += 1
56        elif seq[i] == 'T':60         elif x == 'T':
57            T += 161             T += 1
58     cg_percentage = ((C + G)/(A + C + G + T))*10062         else:
63             continue 
64     cg_percentage = (((C + G) / (len(seq))) * 100)
59     return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)65     return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
t60def hammingdistance(s, t):t66def hammingdistance(seq_aseq_b):
61    if len(s) != len(t): 67    if len(seq_a) != len(seq_b):
62        return('Error: Sequences Length Mismatch')68        return "Error: Sequences Length Mismatch"
69    else:
63    diff = 070        diff = 0
64    for i in range(0, len(s)):71    for i in range(0, len(seq_a)):
65        if s[i] != t[i]:72        if seq_a[i] != seq_b[i]:
66            diff += 173            diff += 1
67    return diff74    return diff
68if __name__=="__main__":75if __name__=="__main__":
69    pass76    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 57

Student ID: 174, P-Value: 9.95e-02

Nearest Neighbor ID: 273

Student (left) and Nearest Neighbor (right).


n1import math n1import math
2def findWinner(boardList):2def findWinner(boardList):
n3    if boardList[0:3:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or boardList[0:8:3n3    if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[1:8:3
>]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[2:7:2]==[1,1,1] or boardLis>]==[1,1,1] or boardList[2:9:3]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardLis
>t[2:9:3]==[1,1,1] or boardList[3:6:1]==[1,1,1] or boardList[6:9:1]==[1,1,1]:  >t[3:6:1]==[1,1,1] or boardList[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or b
 >oardList[2:7:2]==[1,1,1]:
4        return ('X'4        return 'X' 
5    elif boardList[0:3:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or boardList[0:85    elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[1:8
>:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[2:7:2]==[2,2,2] or boardL>:3]==[2,2,2] or boardList[2:9:3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardL
>ist[2:9:3]==[2,2,2] or boardList[3:6:1]==[2,2,2] or boardList[6:9:1]==[2,2,2]:>ist[3:6:1]==[2,2,2] or boardList[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or
 > boardList[2:7:2]==[2,2,2]:
6        return ('O')6        return 'O'
7    else:  7    else: 
8        return ('-'8        return '-'
9    pass9    pass
10def decodeBoard(nBoard):10def decodeBoard(nBoard):
n11    boardList=[] n11    boardList=[]
12    nRemainder=nBoard 12    nRemainder=int(nBoard
13    for digit in range(8,-1,-1): 13    for digit in range(8,-1,-1): 
14        x = nRemainder / (3**digit)14        x = nRemainder / (3**digit)
15        x = math.floor(x)15        x = math.floor(x)
16        nRemainder = nRemainder - ( x * (3**digit) )16        nRemainder = nRemainder - ( x * (3**digit) )
n17        boardList.append(x)n17        boardList.append(x)   
18    return boardList18    return boardList
19if __name__=="__main__":19if __name__=="__main__":
20    passdef countBases(seq):20    passdef countBases(seq):
n21    A = 0 n21    A = 0
22    C = 022    C = 0
23    G = 023    G = 0
n24    T = 0n24    T = 0 
25    for i in range(0,len(seq)): 25    for n in range(0,len(seq)):
26        if seq[i] == 'A': 26        if seq[n]=='A':
27            A+=1 27            A = A+1
28        if seq[i] == 'C':28        elif seq[n]=='C':
29            C+=129            C = C+1
30        if seq[i] == 'G':30        elif seq[n]=='G':
31            G+=131            G = G+1
32        if seq[i] == 'T':32        elif seq[n]=='T':
33            T+=133            T = T+1
34    cg_percentage = ((C+G)/len(seq))*10034    cg_percentage = 100*((C+G)/(len(seq))
35    return '{:d} {:d} {:d} {:d}\n{:3.1f}'.format(A, C, G, T, cg_percentage)35    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
36def hammingdistance(seq_a, seq_b):36def hammingdistance(seq_a, seq_b):
t37    if len(seq_a) == len(seq_b):t37    if len(seq_a)==len(seq_b):
38        diff = 038        count = -1
39        for i in len(seq_a):39        for i in range(0,len(seq_a)):
40            if i not in len(seq_b):40            if seq_a[i]==seq_b[i]:
41                diff+=141                count = count+1
42            return diff42        return count
43        for i in len(seq_b):43    else:
44            if i not in len(seq_a):
45                diff+=1 
46            return diff
47    if len(seq_a) != len(seq_b):
48        return ('Error: Sequences Length Mismatch')44        return 'Error: Sequences Length Mismatch'
49if __name__=="__main__":45if __name__=="__main__":
50    pass46    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 58

Student ID: 311, P-Value: 9.93e-01

Nearest Neighbor ID: 253

Student (left) and Nearest Neighbor (right).


f1import mathf1import math
n2import array as arrn2from math import floor
3import numpy as np
4def checkRows(board):
5    for row in board:
6        if len(set(row)) == 1:
7            return row[0]
8    return 0
9def checkDiagonals(board):
10    if len(set([board[i][i] for i in range(len(board))])) == 1:
11        return board[0][0]
12    if len(set([board[i][len(board) - i - 1] for i in range(len(board))])) == 1:
13        return board[0][len(board) - 1]
14    return 0
15def findWinner(board):3def findWinner(boardList):
16    for newBoard in [board, np.transpose(board)]:4    win = [
17        result = checkRows(newBoard)5        [0, 1, 2],
18        if result:6        [3, 4, 5],
19            return result7        [6, 7, 8],
20    return checkDiagonals(board)8        [0, 3, 6],
9        [1, 4, 7],
10        [2, 5, 8],
11        [0, 4, 8],
12        [2, 4, 6],
13    ]
14    winner = '-'
15    for sub_list in win:
16        if (boardList[sub_list[0]] == 1) and (boardList[sub_list[1]] == 1) and (
 >boardList[sub_list[2]] == 1):
17            winner = 'X'
18            break
19        if (boardList[sub_list[0]] == 2) and (boardList[sub_list[1]] == 2) and (
 >boardList[sub_list[2]] == 2):
20            winner = 'O'
21            break
22    return winner
21def decodeBoard(nBoard):23def decodeBoard(nBoard):
n22    boardList = arr.array('i', [0, 0, 0, 0, 0, 0, 0, 0, 0])n24    boardList=[]
23    startIndex = 8
24    stopIndex = 0
25    step = -1
26    nRemainder = nBoard25    nRemainder=nBoard 
27    for digit in range(startIndex, stopIndex, step):26    for digit in range(8,-1,-1): 
28        x = nRemainder / (3 ** digit)27        x = nRemainder / (3**digit)
29        x = math.floor(x)28        x = math.floor(x)
n30        nRemainder -= (x * (3 ** digit))n29        nRemainder = nRemainder - ( x * (3**digit) )
31        boardList[digit] = x30        boardList.append(x)
32    return boardList31    return boardList
n33if __name__ == "__main__":n
34    testArray = []
35    nBoard = 1815
36    testArray = decodeBoard(nBoard)
37    testArray = np.array(testArray)
38    print(testArray.reshape((3, 3)))
39    testArray2 = [['-', 'O', '-'],
40                  ['X', 'X', 'X'],
41                  ['O', '-', '-']]
42    print('Winner is ', findWinner(testArray2))
43pass
44def countBases(s):
45    number2 = s.count('C') + s.count('G') / s.count('A') + s.count('C') + s.coun
>t('G') + s.count('T') 
46    number = '{:d},{:d},{:d},{:d}\n{:.1f}'.format(s.count('A'), s.count('C'), s.
>count('G'), s.count('T'),number2) 
47    return number
48def hammingdistance(s1, s2):
49    if len(s1) != len(s2):
50        raise ValueError("Sequence Length Mismatch")
51    return sum(ch1 != ch2 for ch1,ch2 in zip(s1,s2))
52if __name__=="__main__":32if __name__=="__main__":
n53    basecount=countBases('ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGAACGGTAAATAAA')n33    board = decodeBoard(2291)
54    print(basecount)34    winner = findWinner(board)
55    print(hammingdistance('GATATCGTCTGGGACCT','CATCGCATTTACGGCCT'))35    print(winner)
36    passfrom itertools import count
37def countBases(seq):
38    A = 0
39    C = 0
40    G = 0
41    T = 0
42    seq_list = [char for char in seq]
43    for item in seq_list:
44        if item == 'A': A += 1
45        if item == 'C': C += 1
46        if item == 'G': G += 1
47        if item == 'T': T += 1
48    sum_CG = C + G
49    cg_percentage = sum_CG / len(seq_list) * 100
50    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
51def hammingdistance(seq_a, seq_b):
52    a_list = [char for char in seq_a]
53    b_list = [char for char in seq_b]
54    hamming_sum = 0
55    if len(a_list) == len(b_list):
56        for a, b in zip(a_list, b_list):
57            if a == b: hamming_sum += 1
58            else: continue
59        return hamming_sum - 1
60    else: return('Error: Sequences Length Mismatch')
56    pass61    pass
tt62if __name__=="__main__":
63    baseCount = countBases('ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGA
 >ACTACTCGATTCACGTTT')
64    print(baseCount)
65    hamming_count = hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT')
66    print(hamming_count)
67    pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op




Page 59

Student ID: 226, P-Value: 9.91e-01

Nearest Neighbor ID: 464

Student (left) and Nearest Neighbor (right).


n1def ternary (n):n1import math
2    if n == 0:2def findWinner(boardList):
3    if boardList[0]==1 and boardList[1]==1 and boardList[2]==1:
3        return '0'4        return'X'
4    nums = []5    elif boardList[3]==1 and boardList[4]==1 and boardList[5]==1:
5    while n:
6        n, r = divmod(n, 3)
7        nums.append(str(r))
8    kacy=int(''.join(reversed(nums)))
9    newlist= list(f'{kacy:09d}')  
10    result =list(map(int,newlist))
11    return result
12def int2str(result):
13    for i in range(len(result)):
14        if result[i]==0:
15            result[i]='-'
16        elif result[i]==1:
17            result[i]='X'
18        elif result[i]==2:
19            result[i]='O'        
20    return result
21def checkwinner(y,z):
22    if (z[0]==y)and(z[1]==y)and(z[2]==y):
23        return True6        return'X'
24    elif (z[3]==y)and(z[4]==y)and(z[5]==y):7    elif boardList[6]==1 and boardList[7]==1 and boardList[8]==1:
25        return True8        return'X'
26    elif (z[6]==y)and(z[7]==y)and(z[8]==y):9    elif boardList[0]==1 and boardList[3]==1 and boardList[6]==1:
27        return True10        return'X'
28    elif (z[0]==y)and(z[3]==y)and(z[6]==y):11    elif boardList[1]==1 and boardList[4]==1 and boardList[7]==1:
29        return True12        return'X'
30    elif (z[1]==y)and(z[4]==y)and(z[7]==y):13    elif boardList[2]==1 and boardList[5]==1 and boardList[8]==1:
31        return True14        return'X'
32    elif (z[2]==y)and(z[5]==y)and(z[8]==y):15    elif boardList[0]==1 and boardList[4]==1 and boardList[4]==1:
33        return True16        return'X'
34    elif (z[0]==y)and(z[4]==y)and(z[8]==y):17    elif boardList[2]==1 and boardList[4]==1 and boardList[6]==1:
35        return True18        return'X'
36    elif (z[2]==y)and(z[4]==y)and(z[6]==y):
37        return True
38    else:19    else:
n39        return Falsen20        if boardList[0]==2 and boardList[1]==2 and boardList[2]==2:
40a=ternary(int(input()))  21            return'O'
41print(int2str(a)) 22        elif boardList[3]==2 and boardList[4]==2 and boardList[5]==2:
42p='X'23            return'O'
43q='O'24        elif boardList[6]==2 and boardList[7]==2 and boardList[8]==2:
44if checkwinner(p,a):25            return'O'
45    final='X'26        elif boardList[0]==2 and boardList[3]==2 and boardList[6]==2:
46elif checkwinner(q,a):27            return'O'
47    final='O'28        elif boardList[1]==2 and boardList[4]==2 and boardList[7]==2:
48else:29            return'O'
49    final='-'  30        elif boardList[2]==2 and boardList[5]==2 and boardList[8]==2:
50print (final)      31            return'O'
32        elif boardList[0]==2 and boardList[4]==2 and boardList[4]==2:
33            return'O'
34        elif boardList[2]==2 and boardList[4]==2 and boardList[6]==2:
35            return'O'
36        else:
37            return('-')
38    pass
39def decodeBoard(nBoard):    
40    boardList=[]
41    nRemainder=nBoard 
42    for digit in range(0,8): 
43        x = nRemainder / (3**digit)
44        x = math.floor(x)
45        nRemainder = nRemainder - ( x * (3**digit) )
46        boardList.append(x)
47    return boardList
48if __name__=="__main__":
49    nBoard = int(input())
50    boardList = decodeBoard(nBoard)
51    print(findWinner(boardList))
51def countBases(seq):52    passdef countBases(seq):
52    A=053    A=0
53    C=054    C=0
54    G=055    G=0
55    T=056    T=0
n56    for i in seq:n57    for i in range(len(seq)):
57        if i=='A':58        if seq[i]=='A':
58            A+=159            A = A+1
59        elif i=='C':60        elif seq[i]=='C':
60            C+=161            C = C+1
61        elif i=='G':62        elif seq[i]=='G':
62            G+=163            G = G+1
63        elif i=='T':64        else:
64            T+=165            T = T+1
65    cg_percentage=float(((C+G)/(A+C+G+T))*100)    66    totalcount=(A+C+G+T)
67    c_percent=C/totalcount
68    g_percent=G/totalcount
69    cg_percentage=(c_percent+g_percent)*100  
66    return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)70    return ('{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage))
67sequence=input()     
68result=countBases(sequence)
69print (result)
70def hammingdistance(seq_a, seq_b):71def hammingdistance(seq_a, seq_b):
nn72    diff=0
71    if len(seq_a)==len(seq_b):73    if len(seq_a)==len(seq_b):
n72        count=0n
73        for i in range(len(seq_a)):74        for i in range(len(seq_a)):
74            if seq_a[i]!=seq_b[i]:75            if seq_a[i]!=seq_b[i]:
n75                count+=1n76                diff+=1
76        return count77            else:
78                diff+=0
79        return(diff)
77    else:80    else:
t78        return'Error: Sequences Length Mismatch't81        return('Error: Sequences Length Mismatch')
79set1=input()82    if __name__=="__main__":
80set2=input()83        slist=input()
81result2=hammingdistance(set1,set2)84        seq=list(slist)
82print(result2)85        s=input()
86        t=input()
87        seq_a=list(s)
88        seq_b=list(t)
89        print(countBases(seq))
90        print(hammingdistance(seq_a,seq_b))
91        pass
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op