Hello,

I am stuck in this exercise and I get the following error when running thecheck of the function:

## ‘’’

TypeError Traceback (most recent call last)

Cell In[108], line 7

4 example_breed = df_test[[“breed”]].loc[0][“breed”]

5 print(f"Example dog has breed {example_breed} and features: height = {example_dog[‘height’]:.2f}, weight = {example_dog[‘weight’]:.2f}, bark_days = {example_dog[‘bark_days’]:.2f}, ear_head_ratio = {example_dog[‘ear_head_ratio’]:.2f}\n")

----> 7 print(f"Probability of these features if dog is classified as breed 0: {prob_of_X_given_C([*example_dog], FEATURES, 0, train_params)}“)

8 print(f"Probability of these features if dog is classified as breed 1: {prob_of_X_given_C([*example_dog], FEATURES, 1, train_params)}”)

9 print(f"Probability of these features if dog is classified as breed 2: {prob_of_X_given_C([*example_dog], FEATURES, 2, train_params)}")

Cell In[107], line 42, in prob_of_X_given_C(X, features, breed, params_dict)

39 p = params_dict[breed][feature_name][“p”]

41 # Compute the relevant pmf given the distribution and the estimated parameters

—> 42 probability_f = pmf_binomial(X, n, p)

44 case “ear_head_ratio”:

45 # Get the relevant parameters out of the params_dict dictionary

46 a = params_dict[breed][feature_name][“a”]

Cell In[100], line 16, in pmf_binomial(x, n, p)

14 print(x)

15 ### START CODE HERE ###

—> 16 pmf = (comb(n, x))*(p**x)*((1-p)**(n-x))

17 ### END CODE HERE ###

19 return pmf

TypeError: unsupported operand type(s) for -: ‘int’ and ‘list’

‘’’

However, the pmf_binomial function works ok:

```
def pmf_binomial(x, n, p):
# {moderator edit: code removed}
return pmf
```

The prob_of_X_given_C function looks like that:

```
def prob_of_X_given_C(X, features, breed, params_dict):
if len(X) != len(features):
print("X and list of features should have the same length")
return 0
probability = 1.0
### START CODE HERE ###
# {moderator edit: code removed}
### END CODE HERE ###
return probability
```