<jupyter_start><jupyter_text>Exercise 1Add the specified code for each code cell, running the cells _in order_. Write a **`while`** loop that prints out every 5th number (multiples of 5) from 0 to 100 (inclusive).- _Tip:_ use an **`end=','`** keyword argument to the `print()` function to print all the numbers on the same line.<jupyter_code>n = 0
while n <= 100:
    print(n, end=",")
    n = n + 5<jupyter_output>0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,<jupyter_text>Use a **`while`** loop to print out the first 15 [Triangular numbers](https://en.wikipedia.org/wiki/Triangular_number). This is a sequence of numbers for which the _nth_ value is the sum of the numbers from 0 to _n_. **Do this only using addition!**- _Hint:_ use an additional variable to keep track of the `total` value, and have that value increase by the number of times you've been through the loop each iteration!<jupyter_code>total = 1
while total <= 15:
    t = int(total * (total + 1)/2)
    print(t, end=',')
    total = total + 1<jupyter_output>1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,<jupyter_text>_Challenge_ Use a **`while`** loop to print out 20 numbers, each of which is larger than the previous by the the _sum_ of the **two** previous numbers (the [Fibonacci sequence](https://en.wikipedia.org/wiki/Fibonacci_number).- _Hint_: you'll need to keep track of the two previous values (start them at 0 and 1), and then "update" them each time through the loop, storing the  "new total" in the first previous variable, and the first previous variable in the second (be careful about the ordering of this!)<jupyter_code>total = 1
n1 = 0
n2 = 1
while total <= 20:
    n2 = n1 + n2
    n1 = n2 - n1
    print(n2)
    total = total + 1<jupyter_output>1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946<jupyter_text>Use a **`while`** loop to print out a sequence of random numbers from 0 to 10, stopping after the number `4` is printed for the first time. You will need to import the `random` module.<jupyter_code>import random
n = 0
while n != 4:
    n = random.randint(0, 10)
    print(n)<jupyter_output>10
5
8
5
3
1
9
4<jupyter_text>Modify the below "coin flipping" example from the course text so that it keeps flipping coins until you get two "heads" in a row.<jupyter_code># flip a coin until it shows up heads twice in a row
lastflip = "none"
still_flipping = True
while still_flipping:
    flip = random.randint(0,1)
    if flip == 0:
        flip = "Heads"
    else:
        flip = "Tails"
    print(flip, end=", ")
    if flip == "Heads" and lastflip == "Heads":
        still_flipping = False
    lastflip = flip<jupyter_output>Tails, Heads, Tails, Tails, Tails, Heads, Tails, Heads, Heads,<jupyter_text>Define a function **`input_number()`** that takes a minimum and maximum value as arguments. This function should prompt the user to input a number within the range, repeating the prompt if the provided value is not acceptable. Once an acceptable value has been provided, the function should return that number. You can assume that the user-entered input will always be numeric.Be sure and call your function and print its results to test it!<jupyter_code>def input_number(min, max):
    min = int(min)
    max = int(max)
    n = input("Enter a number within the range: ")
    n = int(n)
    while n < min or n > max:
        n = input("Enter a number within the range: ")
        n = int(n)
    return n

input_number(7, 200)<jupyter_output>Enter a number within the range: 202
Enter a number within the range: 300
Enter a number within the range: -30
Enter a number within the range: 33
{'fraction_non_alphanumeric': 0.09770908087220535, 'fraction_numerical': 0.05409881313828319, 'mean_word_length': 4.019390581717452, 'pattern_counts': {'":': 1, '<': 23, '<?xml version=': 0, '>': 20, 'https://': 2, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '555396', 'license': 'MIT', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1181, 'n_words': 509, 'path': 'exercise-1/exercise.ipynb', 'repo_name': 'chelseajames/ch7-iteration', 'size': '3623'}