Here is Exercise 6:
Here is Exercise 7:
Reflection:
At first, I was confused by creating two variables for the same input. Then, thinking in math terms really helps me understand. The functions are basically Y=f(X) where X is a random variable and Y could be a numerical result, a textual output, or an action. When utilizing the function in the code, the computer is calculating f(k). Here k is an input, which is different from the random variable X. The output f(k) is the result that we want.