Duplicate roll numbers can be added in add_student due to incorrect comparison of roll numbers as strings instead of integers. #15
Labels
bugbounty
Bug Bounty event hosted by Devlup Labs, inviting developers to identify and report bugs
good first issue
Good for newcomers
Description
The add_student function does not properly check for duplicate roll numbers due to incorrect comparison of roll numbers as strings instead of integers, allowing duplicates to be added.
Files
List the relevant files associated with this issue. This will guide contributors in navigating the project effectively and provide clues on where to start.
To Reproduce
Expected Behavior
The add_student function should reject the addition of a new student with a roll number that already exists in the system.
Actual Behavior
The function accepts both roll numbers as different due to string comparison, allowing duplicate entries.
Tasks
Possible Fixes
Change the comparison in add_student from
str(student.roll_no) == str(roll_no)
tostudent.roll_no == roll_no
to ensure both are compared as integers.The text was updated successfully, but these errors were encountered: