Skip to content

Update check_polygon.pyfix(maths): validate minimum sides for polygon in check_polygon.py - #15320

Merged
cclauss merged 3 commits into
TheAlgorithms:masterfrom
mohitkumar188:improve-maths-check-polygon
Sep 18, 2026
Merged

cclauss merged 3 commits into
TheAlgorithms:masterfrom
mohitkumar188:improve-maths-check-polygon

Conversation

@mohitkumar188

Copy link
Copy Markdown
Contributor

Describe your change:

  • Fixed condition len(nums) < 3 because polygons require at least 3 sides (triangles). Previously, 2-sided inputs did not raise the ValueError despite the error message stating digons are invalid.
  • Simplified sorting logic using sorted().
  • Added doctest for 2-element input ([4, 5]).

Checklist:

  • I have read the CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file.
  • All doctests pass with python -m doctest -v ....

@cclauss

cclauss commented Sep 15, 2026

Copy link
Copy Markdown
Member

ON HOLD: Our focus is on merging or closing old pull requests before October 1st.

@cclauss
cclauss merged commit 8562a37 into TheAlgorithms:master Sep 18, 2026
6 checks passed
@mohitkumar188
mohitkumar188 deleted the improve-maths-check-polygon branch September 20, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants