Solution py-distance-class#2792
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I'm requesting changes because the implementation has critical failures that are blocking task completion.
Critical issues that must be fixed:
-
Missing period in
__str__(5 test failures): Your__str__method returns "Distance: 50 kilometers\n" but the required format is "Distance: 50 kilometers." with a trailing period. Add a period after "kilometers" in the return statement. -
__mul__incorrectly acceptsDistanceargument: The type annotation includesDistancebut the checklist explicitly states__mul__should only acceptint | float. You need to removeDistancefrom the type annotation and remove any code that handlesDistanceinstances (it should raiseTypeErrorforDistanceoperands). -
__truediv__incorrectly acceptsDistanceargument: Same issue as__mul__- the type annotation includesDistancebut the checklist forbids it. RemoveDistancehandling from the implementation. -
Unnecessary
elsestatements [CHECKLIST ITEM #1]: Every method followsif ... return ... else: ...which is redundant. Remove allelseblocks afterreturnstatements since the function already exits. For example:def __add__(self, other): if isinstance(other, Distance): return Distance(self.km + other.km) return Distance(self.km + other) # No else needed
The test failures confirm these are functional blockers. Fix the __str__ period issue first since it affects the most tests.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
No description provided.