Question: import numpy as np import random as rd import pandas as pd import scipy.stats as st Question 1 Given a list of numbers. Create a
import numpy as np import random as rd import pandas as pd import scipy.stats as st Question 1 Given a list of numbers. Create a function that reports the average, standard deviation, minumum and maximum values as rows of a DataFrame. The indices of the dataframe will be ['average', 'standard deviation', 'minumum', 'maximum'] with a single column named 'output'. Test your function using the list $l1 = [50, 25, 47, 76, 21, 69, 87, 75, 81, 74, 73, 79, 85, 67, 86, 97, 90]$.
Question 2
Given three lists of numbers, build a function that combines the three lists in a one sorted list. Test your function with $l1 = [1, 2, 3]$, $l2 = [3, 6, 7]$, and $l3 = [4, 5, 6]$.
Question 3 Given a list of numbers and a single target number, build a function that returns the indices of the two numbers from the list such that they add up to the target number. Each input would have exactly one solution: return the two indices as soon as you find a match (you do not care if there are multiple solutions. If you find a solution, it gets returned immediately). If no such numbers are found, return False. Make sure the two indices are not the same.
Question 4
Let $T$ be an exponential random variable, such that $\sim$ exp($\mu$). Build a function named **prob** to compute the probability $P(T \leq x)$ for any possible $\mu$ via simulation. Define $\mu$ and $x$ and the number of runs (iterations) as arguments for the **prob** function. Finally, test your function with $\mu = 10$ and $x = 15$.
**Note:** Set a default value for number of runs (iterations) equal to 10000
Question 5
Let *$T_{i}$* a set of exponential random variables, such that $\sim$ exp($\mu_{i}$). Build a function named **probs** to compute the set of probabilities $P(T_{i} \leq x)$ for $\mu_{i}$ $\in$ $\{10,...,25\}$ via simulation. Define $x$ as the only argument for the **probs** function. Return your outcomes as a two-columns DataFrame, *mu_values* and *probs* (indices be automatically set). Finally, test your function when $x = 15$.
**Note:** * Use the prob function from previous problem in your new function
Question 6
Two fair dices are rolled: if the sum of the up faces is 3 or 11 or if they match (e.g., (1, 1)), the game is won. Build a function to estimate the probability of a win via simulation. Set the number of runs as an argument of the function. Finally, test the function using 10000 runs.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
