Exercise

# Calculating the sample size

You're now going to utilize the sample size function to determine how many users you need for the test and control groups under various circumstances.

Included is the `get_sample_size()`

function you viewed previously, which takes four primary arguments, `power`

, `p1`

, `p2`

and `cl`

as described before:

```
def get_sample_size(power, p1, p2, cl, max_n=1000000):
n = 1
while n <= max_n:
tmp_power = get_power(n, p1, p2, cl)
if tmp_power >= power:
return n
else:
n = n + 100
return "Increase Max N Value"
```

You will continue working with the paywall conversion rate data for this exercise, which has been pre-loaded as `purchase_data`

.

Instructions 1/3

**undefined XP**

Calculate the baseline `conversion_rate`

per paywall view by dividing the total amount spent across all `purchase_data.purchase`

values by
the count of `purchase_data.purchase`

values in the dataset.