In this project, we want to update our random box script so thatthe boxes end up sorted from smallest on top to largest on thebottom.
Start with your final .blend file from Class Project 10(Python Decision Structures in Blender).
Make sure your swap function swaps the boxes in the boxes listand also swaps the boxes with respect to their locations; i.e.:
def swap(boxes, i, j):
# swap the boxes in the boxes list
temp = boxes[i]
boxes[i] = boxes[j]
boxes[j] = temp
# swap the boxes w.r.t. their locations onthe Z axis
loc_i = boxes[i].location.z
loc_j = boxes[j].location.z
boxes[i].location.z = loc_j
boxes[j].location.z =
OR
OR