Why is one nested loop quadratic, another only linear, and a third secretly cubic because of a single in check?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
These are the two loop headers of diameter, written for a list of n points:
for i in range(n): for j in range(i+1, n): ...
Count every pass of the inner loop, then divide by the number of outer passes to get the average run of the inner loop. Define average_inner(n) returning that average as a float (you may assume n is at least 1).