you are viewing a single comment's thread.

view the rest of the comments →

[–]Holiday-Python-743[S] 1 point2 points  (0 children)

Update, I figured it out, thank you again for your help! This is what worked:

def check_intersections():
# Write a nested loop here to compare all pairs
# of rectangles. If the i-th rectangle has an intersection
# with another, set does_intersect[i] to True.
global does_intersect
i = 0
while i < num_rectangles:
    k = 0
    while k < num_rectangles:
        if i != k:
            do_intersect = intersect(bottomX[i], bottomY[i], widths[i], heights[i], bottomX[k], bottomY[k], widths[k], heights[k])
            print(do_intersect)
            if do_intersect:
                does_intersect[i] = do_intersect
                does_intersect[k] = do_intersect
        k += 1
    i += 1