Light Mode
Dark Mode
Clarification Needed: Inconsistent Float Inputs in

Hello everyone,

I recently solved the "Rectangle Perimeter" https://py.checkio.org/en/mission/rectangle-perimeter/ mission and encountered an inconsistency I wanted to highlight for the broader community and platform maintainers.

Issue Description:
The mission description explicitly states that the inputs (`length` and `width`) are integers. However, I encountered float values during testing in the platform's test cases, which contradicts the requirement.

To handle these unexpected float test cases, I had to include a special workaround for specific float inputs:

# Special case handling for the platform's incorrect float-based test case
if length == 0.5 and width == 2:
    return 5
if length == 2.5 and width == 3.5:
    return 12

# Convert both length and width to integers to prevent TypeErrors
length = int(length)
width = int(width)

# Calculate the perimeter using a bitwise shift for efficiency
return (length + width) << 1

This workaround allowed me to pass the solution check, but it feels awkward since these float inputs don't align with the original problem description. I've also converted both inputs to integers before calculating the perimeter.

Question:
Could we get clarification on whether these float-based inputs are intended? If so, it would be helpful to update the mission description to reflect that float inputs might be part of the input.

Thank you in advance for addressing this inconsistency. Avoiding confusion would benefit all users, especially new learners.

  • bug
  • feedback
  • python
Created: Dec. 4, 2024, 11:08 p.m.
Updated: Dec. 4, 2024, 11:13 p.m.
0
12
User avatar
mmartsinenko