Question: Question 1 Implementation with lambda expressions The correct answer could be just one line long. This suggests that lambda expression is an excellent way to

Question 1

Implementation with lambda expressions

The correct answer could be just one line long. This suggests that lambda expression is an excellent way to make your code short and succinct.

Implement a lambda version of compute_lower_bound named shorthand_ci

#YOUR CODE HERE

Note: This was my initial code but it didn't run. I don't know what i did wrong.

shorthand_ci = lambda n, mean, std, z: (mean - z * std / (n0.5), mean + z * std / (n0.5))

Question 2

Simulation

A. Use np.random.randint to simulate age data for 100 adults, whose age range from 18 to 36.

Then, calculate basic descriptive statistics (mean, median, standard deviation) for your simulated data.

B. Repeat the process in Question A, except the age range is now 27 to 54.

C. Visualization

Display each age grouop using a side-by-side boxplot. You MUST use either matplotlib or seaborn library for this task.

Note: question A and B has been answered.

For question C, my code is displayed below.

import matplotlib.pyplot as plt import seaborn as sns sns.boxplot(x='age_group', y='age', data=df, width=0.4, color='lightblue') plt.show()

Note: This was the error message i got for question C

NameError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_12632\610683687.py in  2 import matplotlib.pyplot as plt 3 import seaborn as sns ----> 4 sns.boxplot(x='age_group', y='age', data=df, width=0.4, color='lightblue') 5 plt.show() 6 NameError: name 'df' is not defined

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!