-
-
Notifications
You must be signed in to change notification settings - Fork 46.7k
Added some more comments to volume.py in maths folder #7080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
added some more comments (to formulas which need it) which make the code more readable and understandable. might make a list of all the formulas on the top, later
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved the comments down to be just above the calculations. I have changed the order of the terms to be the same in both the comments and the calculations. I have changed Volume -
to Volume is
because -
has a special meaning in calculations. ;-)
Please fix the line that is failing our tests because it has more than 88 characters.
maths/volume.py
Outdated
# Volume - 4/3 * pi * radius cubed | ||
if radius < 0: | ||
raise ValueError("vol_hemisphere() only accepts non-negative values") | ||
return 2 / 3 * pi * pow(radius, 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Volume - 4/3 * pi * radius cubed | |
if radius < 0: | |
raise ValueError("vol_hemisphere() only accepts non-negative values") | |
return 2 / 3 * pi * pow(radius, 3) | |
if radius < 0: | |
raise ValueError("vol_hemisphere() only accepts non-negative values") | |
# Volume is radius cubed * pi * 2/3 | |
return pow(radius, 3) * pi * 2 / 3 |
maths/volume.py
Outdated
# Volume - radius squared * height * pi | ||
if height < 0 or radius < 0: | ||
raise ValueError("vol_circular_cylinder() only accepts non-negative values") | ||
return pi * pow(radius, 2) * height |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Volume - radius squared * height * pi | |
if height < 0 or radius < 0: | |
raise ValueError("vol_circular_cylinder() only accepts non-negative values") | |
return pi * pow(radius, 2) * height | |
if height < 0 or radius < 0: | |
raise ValueError("vol_circular_cylinder() only accepts non-negative values") | |
# Volume is radius squared * height * pi | |
return pow(radius, 2) * height * pi |
maths/volume.py
Outdated
@@ -378,6 +385,7 @@ def vol_conical_frustum(height: float, radius_1: float, radius_2: float) -> floa | |||
... | |||
ValueError: vol_conical_frustum() only accepts non-negative values | |||
""" | |||
# Volume - 1/3 * pi * height * (radius_1 squared + radius_2 squared + radius_1 * radius_2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are failing on:
- maths/volume.py:388:89: E501 line too long (94 > 88 characters)
Also, please move this line down to be just above the calculation. Make sure that the order of the values in the comment and in the calculation are the same.
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change "volume -" to "volume is" because - has another meaning which would not apply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank u for the changes!
how do i commit your changes? |
for more information, see https://pre-commit.ci
Hello Sir, Can you assign this to me? |
added some more comments (to formulas which need it) which make the code more readable and understandable. might make a list of all the formulas on the top, later
Checklist:
Fixes: #{$ISSUE_NO}
.