<jupyter_start><jupyter_text>**1**.A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.Find the largest palindrome made from the product of two 3-digit numbers.(Source: Project Euler Problem 4)<jupyter_code>p_num = 0
for i in range(100, 1000):
    for j in range(100, 1000):
        num = i * j
        if(str(num) == str(num)[::-1]):
            p_num = max(p_num, num)
print(p_num)<jupyter_output>906609<jupyter_text>**2**.Construc the following matrix```pythonarray([[18, 13, 10,  9, 10, 13, 18],       [13,  8,  5,  4,  5,  8, 13],       [10,  5,  2,  1,  2,  5, 10],       [ 9,  4,  1,  0,  1,  4,  9],       [10,  5,  2,  1,  2,  5, 10],       [13,  8,  5,  4,  5,  8, 13],       [18, 13, 10,  9, 10, 13, 18]])```<jupyter_code>np.fromfunction(lambda i, j: (i - 3)**2 + (j - 3)**2, (7, 7), dtype = 'int')<jupyter_output><empty_output><jupyter_text>**3**.Using numpy and string manipulation, create a DNA string with 150 bases that have the following probabilities: (A, 0.5), (C, 0.2), (T, 0.2), (G, 0.1). Find the most common triplet of bases in among sliding windows of this DNA string. For example, a sliding window of size 3 for GATTACA would be GAT, ATT, TTA, TAC, ...<jupyter_code>dna = np.random.choice(list('ACTG'), size = 150, p=[0.5,0.2,0.2,0.1])
#triplets = list(map(lambda x: ''.join(x), np.c_(dna[:-2], dna[1:-1], dna[2:])))
triplets = [''.join(x) for x in zip(dna[:-2], dna[1:-1], dna[2:])]

from collections import Counter
Counter(triplets).most_common(1)<jupyter_output><empty_output><jupyter_text>**4**.- Using only base Python and numpy, create a pairwise distance matrix of the two sets of *row* vectors given- Scale the distances so that each *row* has mean zero and standard deviation 1Use Euclidean distance.<jupyter_code>np.random.seed(123)
xs = np.random.randint(1,10, (10, 5))
ys = np.random.randint(1,10, (8, 5))
print(xs[1])
print(ys[2])
nr = xs.shape[0]
nc = ys.shape[0]

dist = np.zeros([nr, nc])

for i in range(nr):
    for j in range(nc):
        dist[i, j] = np.sqrt(np.sum((xs[i] - ys[j])**2))

dist
(dist - np.mean(dist, axis = 1)[:, np.newaxis]) / np.std(dist, axis = 1)[:, np.newaxis]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18023255813953487, 'fraction_numerical': 0.0742397137745975, 'mean_word_length': 3.769722814498934, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '532796', 'license': 'MIT', 'n_tokens_mistral': 994, 'n_tokens_neox': 884, 'n_words': 274, 'path': 'notebooks/exercises/S03_exercises.ipynb', 'repo_name': 'itachi4869/sta-663-2021', 'size': '2236'}