Splitting two classes into groups of the same size

Fill in the blanks · Medium · §7.6, §7.7 [Pair coding with AI] Asking for loops

Two classes, with a students and b students, are split into groups that all have the same number of students. Neither class may have any students left over. Collect every possible group size, and also print the largest group size. Write Blank 1 so that the code checks every number up to and including the smaller of the two numbers.

Code with blanks

a = 24
b = 36
sizes = []
for k in range(1, ____):
    if a % k == 0 and b % k == 0:
        sizes.____
print(sizes)
print("Largest group:", ____)

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.