-5

"If the division does not go evenly, there may be fewer students in one group, but all others must have the desired number."

x = float(input("How many students"))
y = float(input("What is the group size?"))

division = (x / y)
remainder = (x % y)


print(f"Group size: ")

1 Answers1

0

You can do it like this:-

import math 
x = float(input("How many students"))
y = float(input("What is the group size?"))

division = (x / y)
remainder = (x % y)
if remainder == 0:
    print(f" No of Groups: {division}")
else:
    print("No of Groups:", math.ceil(division))
Python learner
  • 1,159
  • 1
  • 8
  • 20
  • 2
    The test is useless, you can do directly: `print(f" No of Groups: {math.ceil(x/y)}")`, if y is a divider of x, then `math.ceil(x/y) == x/y` – mozway Jan 05 '22 at 08:32