Skip to content

Validation Bug in part01-20_students_in_groups #47

Description

@ErionEduard

I believe there may be an issue with the automatic grader for the "Students in groups" exercise.

I submitted the following solution, not expecting it to pass, and it was accepted as correct:

python
student = int(input("How many students on the course? "))
grsize = int(input("Desired group size? "))

grnum = int(student // grsize)
if grnum != 3 or 5 or 7:
print(f"Number of groups formed: {grnum}")

if grnum == 3 or 5 or 7:
print(f"Number of groups formed: {grnum + 1}")

Output 1:
How many students on the course? 8
Desired group size? 4
Number of groups formed: 2
Number of groups formed: 3

Output 2:
Output
How many students on the course? 11
Desired group size? 3
Number of groups formed: 3
Number of groups formed: 4

Correct solution:

students = int(input("How many students on the course? "))
group_size = int(input("Desired group size? "))
groups = (students + group_size - 1) // group_size
print("Number of groups formed:", groups)

I wanted to report this in case the test suite is missing some test cases or is not validating the output strictly enough.

Thank you for all the work you put into the course.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions