Skip to content

Conversation

@benarch
Copy link

@benarch benarch commented Jan 31, 2026

Description

Adds a new algorithm to compute the harmonic mean of numbers.

The harmonic mean is defined as n divided by the sum of the reciprocals of n numbers. It is particularly useful for calculating average rates (e.g., speed, density).

Changes

  • Added maths/harmonic_mean.py with:
    • compute_harmonic_mean() function
    • Comprehensive doctests
    • Proper error handling for edge cases

Reference

Checklist

  • I have read CONTRIBUTING.md
  • This pull request is all my own work
  • I added relevant tests
  • All new and existing tests passed

@algorithms-keeper algorithms-keeper bot added awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant