Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

update variable names for consistency using standard formula terms; #2223

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

Merged
merged 2 commits into from
Jul 22, 2020
Merged

update variable names for consistency using standard formula terms; #2223

merged 2 commits into from
Jul 22, 2020

Conversation

lance-pyles
Copy link
Contributor

fix flake8 syntax errors;

fix doctests;

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read 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. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

Copy link
Member

@ruppysuppy ruppysuppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the cube and square, I think side_length as the param is better, apart from that, good job

@lance-pyles
Copy link
Contributor Author

I used side because that is what wikipedia uses in the formula, A = s^2. Reading the article closer, s is for side length, not just side. Change is in, thanks.

@@ -48,24 +48,24 @@ def area_square(side_length):
>>> area_square(10)
100
"""
return side_length * side_length
return pow(side_length, 2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds function call overhead but let's let it slide.



def area_parallelogram(base, height):
"""
Calculate the area of a parallelogram

>> area_parallelogram(10,20)
>>> area_parallelogram(10,20)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -75,8 +75,8 @@ def area_trapezium(base1, base2, height):
"""
Calculate the area of a trapezium

>> area_trapezium(10,20,30)
450
>>> area_trapezium(10,20,30)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks.

@cclauss cclauss merged commit b395003 into TheAlgorithms:master Jul 22, 2020
@lance-pyles lance-pyles deleted the area-fixes-updates branch July 22, 2020 23:59
@cclauss cclauss mentioned this pull request Jul 24, 2020
14 tasks
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
…heAlgorithms#2223)

* update variable names for consistency using standard formula terms;

fix flake8 syntax errors;

fix doctests;

* tweak to variable name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants