Included area of n sided regular polygon#7438
Merged
cclauss merged 4 commits intoTheAlgorithms:masterfrom Oct 25, 2022
mislah:patch-4
Merged
Included area of n sided regular polygon#7438cclauss merged 4 commits intoTheAlgorithms:masterfrom mislah:patch-4
cclauss merged 4 commits intoTheAlgorithms:masterfrom
mislah:patch-4
Conversation
Added a function to calculate the area of n sided regular polygons
for more information, see https://pre-commit.ci
ZeroDayOwl
suggested changes
Oct 20, 2022
| @@ -458,6 +458,49 @@ def area_rhombus(diagonal_1: float, diagonal_2: float) -> float: | |||
| return 1 / 2 * diagonal_1 * diagonal_2 | |||
Contributor
There was a problem hiding this comment.
Perhaps add some doctests here too.
Contributor
Author
There was a problem hiding this comment.
Hey there! doctests were already present in there. I wonder if that's a mistake.
Comment on lines
524
to
+529
| print(f"Cone: {surface_area_cone(10, 20) = }") | ||
| print(f"Conical Frustum: {surface_area_conical_frustum(10, 20, 30) = }") | ||
| print(f"Cylinder: {surface_area_cylinder(10, 20) = }") | ||
| print(f"Equilateral Triangle: {area_reg_polygon(3, 10) = }") | ||
| print(f"Square: {area_reg_polygon(4, 10) = }") | ||
| print(f"Reqular Pentagon: {area_reg_polygon(5, 10) = }") |
Contributor
There was a problem hiding this comment.
You don't need them since you already used doctest to test your code.
Contributor
Author
There was a problem hiding this comment.
Hi @ZeroDayOwl , Based on the format of preexisting functions, I doubt if I'm allowed to proceed with your suggestion.
CaedenPH
reviewed
Oct 20, 2022
| "area_reg_polygon() only accepts non-negative values as \ | ||
| length of a side" | ||
| ) | ||
| return (sides * length**2) / (4 * tan(pi / sides)) |
Contributor
There was a problem hiding this comment.
Suggested change
| return (sides * length**2) / (4 * tan(pi / sides)) | |
| return (sides * pow(length, 2)) / (4 * tan(pi / sides)) |
Contributor
Author
There was a problem hiding this comment.
Hi @CaedenPH , Based on the format of preexisting functions, I doubt if I'm allowed to commit your suggestion.
cclauss
approved these changes
Oct 25, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a function to calculate the area of n sided regular polygons
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.