<jupyter_start><jupyter_text>**1**. Replicate the contents below by creating a new (MarkDown) cell below this one (using keyboard shortcuts). Euler's formulaThe function $e^{i \phi}$ traces the unit circle in the complex plane. $$e^{i\phi} = \cos \phi + i \sin \phi$$This implies that \begin{align}\cos x &= \Re(e^{i x}) &= \frac{e^{ix} + e^{-ix}}{2} \\\sin x &= \Im(e^{i x}) &= \frac{e^{ix} - e^{-ix}}{2} \end{align}In Python, we can express the second function as ```pythondef sin(x):    """The sine function ."""    import numpy as np    return 0.5*(np.exp(x*1j) - np.exp(-x*1j))``` **1.5**. Delete this cell using a keyboard shortcut. **2**. Write a program to create a list of the first 100 Fizz buzz numbers. Any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. Otherwise the original number is retained.For example, the first Fizz buzz numbers are  `1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, 16, 17, Fizz, 19, Buzz, Fizz, 22, 23, Fizz, Buzz, 26, Fizz, 28, 29, Fizz Buzz, 31, 32, Fizz, 34, Buzz, Fizz, ...`.<jupyter_code>fb = []
for i in range(100):
    if i % 15 == 0:
        fb.append("fizz buzz")
    elif i % 5 == 0:
        fb.append("buzz")
    elif i % 3 == 0:
        fb.append("fizz")
    else:
        fb.append(i)
        
fb<jupyter_output><empty_output><jupyter_text>**3**. A Pythagorean triplet is a set of 3 integers $a, b, c$ such that $a^2 + b^2 = c^2$. For example, the tuple (3,4,5) is a  Pythagorean triplet. Find all Pythagorean triplets where $c < 100$.<jupyter_code>for a in range(1,100):
    for b in range(a, 100):
        for c in range(b, 100):
            if a**2 + b**2 == c**2:
                print(a, b, c)<jupyter_output>3 4 5
5 12 13
6 8 10
7 24 25
8 15 17
9 12 15
9 40 41
10 24 26
11 60 61
12 16 20
12 35 37
13 84 85
14 48 50
15 20 25
15 36 39
16 30 34
16 63 65
18 24 30
18 80 82
20 21 29
20 48 52
21 28 35
21 72 75
24 32 40
24 45 51
24 70 74
25 60 65
27 36 45
28 45 53
30 40 50
30 72 78
32 60 68
33 44 55
33 56 65
35 84 91
36 48 60
36 77 85
39 52 65
39 80 89
40 42 58
40 75 85
42 56 70
45 60 75
48 55 73
48 64 80
51 68 85
54 72 90
57 76 95
60 63 87
65 72 97<jupyter_text>**4**. Write a program using a dictionary to find the top 3 most frequently occurring words and how often they occur in the passage given below. Remove punctuation and convert words to lower case. We consider a word to be any continuous sequence of characters or numbers separated by whitespace.    > Write a program to create a list of the first 100 Fizz buzz numbers. Any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. Otherwise the original number is retained.For example, the first Fizz buzz numbers are  1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, 16, 17, Fizz, 19, Buzz, Fizz, 22, 23, Fizz, Buzz, 26, Fizz, 28, 29, Fizz Buzz, 31, 32, Fizz, 34, Buzz, Fizz, ....<jupyter_code>text = 'Write a program to create a list of the first 100 Fizz buzz numbers. Any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. Otherwise the original number is retained. For example, the first Fizz buzz numbers are 1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, 16, 17, Fizz, 19, Buzz, Fizz, 22, 23, Fizz, Buzz, 26, Fizz, 28, 29, Fizz Buzz, 31, 32, Fizz, 34, Buzz, Fizz, ....'
from string import punctuation
table = dict.fromkeys(ord(c) for c in punctuation)
text = text.translate(table)
words = text.strip().lower().split()
counter = {}
for word in words:
    counter[word] = counter.get(word, 0) + 1
sorted(counter.items(), key=lambda x: x[1], reverse=True)[:3]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1141599792907067, 'fraction_numerical': 0.11597204245405125, 'mean_word_length': 3.3661016949152542, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '285049', 'license': 'MIT', 'n_tokens_mistral': 1737, 'n_tokens_neox': 1322, 'n_words': 661, 'path': 'worksheet/01_Programming_In_Python_Solutions.ipynb', 'repo_name': 'cliburn/sta-663-2017', 'size': '3863'}