Just documenting this since I couldn’t find anything addressing this specific error. It looks like a problem with the given code. Not expecting an answer here.

Cell #4 gets this error if I try to call the function with `probabilities = True`

```
---> 19 plotImages(sample_training_images[:5], True)
----> 9 for img, probability, ax in zip( images_arr, probabilities, axes):
'bool' object is not iterable
```

If I try to call it with the True argument to display probabilities. To me, it looks like it’s just not written correctly.

```
# 4
def plotImages(images_arr, probabilities = False):
fig, axes = plt.subplots(len(images_arr), 1, figsize=(5,len(images_arr) * 3))
if probabilities is False:
for img, ax in zip( images_arr, axes):
ax.imshow(img)
ax.axis('off')
else:
for img, probability, ax in zip( images_arr, probabilities, axes):
ax.imshow(img)
ax.axis('off')
if probability > 0.5:
ax.set_title("%.2f" % (probability*100) + "% dog")
else:
ax.set_title("%.2f" % ((1-probability)*100) + "% cat")
plt.show()
sample_training_images, _ = next(train_data_gen)
plotImages(sample_training_images[:5], True) #I added True here
#False works as expected
```

First it tries to unpack:

```
for img, probability, ax in zip( images_arr, probabilities, axes):
```

This is what causes the error since it’s a boolean and not a list. Later we have

```
if probability > 0.5:
```

Which isn’t going to work either with a Boolean value. Not sure if there is another way to unpack the probabilities but just moving on for now, not expecting an answer here since this is all deprecated anyways.

Similar thread here:

https://forum.freecodecamp.org/t/machine-learning-w-python-project-2-dog-cat-images-probabilities-list-question/420406

But they go onto other topics…