Zero division error in Exercise 2 while calculating IOU

I am getting the following error in the test code block of Exercise -2 viz. calculating Intersection over Union. And I think I have computed all the coordinates correct as per the hints given. Any help will be appreciated.

ZeroDivisionError: division by zero

As you see in the definition of “intersection over Union”, “iou” is calculated with “intersection area” and “union of areas”. In the exercise 2, only one chance to use “division” is to calculate this “iou”.
And, error says that the denominator is 0.
So, the next step is to check actual values for “intersection area” and “union of areas”, and find your error in calculation.

Thanks, it worked. I found the error of writing max instead of min at two places.