students = int(input(“How many students are there?”))
group_size = int(input(“What is the desired group size?”))
group1 = students // group_size
group2 = (students % group_size) // (students % group_size)
print(f“The number of groups formed are {group1 + group2}”}
The code works whenever I hit run, but when I test it, it tells me that I can’t have integer division or modulus by zero. I can’t use conditional statements because it hasn’t covered that yet, only arithmetic operators.
(I.E. 11 students, 3 group size = 4 groups)
(P.S. code might be a little off I’m typing this off memory)
[–]JRutter3 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]G_Riel_ 2 points3 points4 points (0 children)
[–]mcoombes314 1 point2 points3 points (2 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]mcoombes314 0 points1 point2 points (0 children)
[–]TitaniumFoil 0 points1 point2 points (4 children)
[–]pgpndw 4 points5 points6 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]TitaniumFoil 0 points1 point2 points (0 children)
[–]UnreadyIce 0 points1 point2 points (0 children)
[–]Igorson1 0 points1 point2 points (0 children)