Conversation
maths/series/geometric_mean.py
Outdated
| """ | ||
| if len(series) == 1: | ||
| return True | ||
| common_ratio = series[1] / series[0] |
There was a problem hiding this comment.
Also if series[0] is 0 will fail as well
There was a problem hiding this comment.
Will fail with empty series.
for that I have check the size of list. If it is zero then It will raise an error.
if len(series) == 0:
raise ValueError("Input list must be a non empty list")Would it be fine or ... how can I do it in a better way ?
maths/series/geometric_mean.py
Outdated
| raise ValueError("Input list is not a geometric series") | ||
| answer = 1 | ||
| for _ in series: | ||
| answer *= _ |
There was a problem hiding this comment.
I don't like it named _. _ means that it's not important but actually it's affecting answer variable.
There was a problem hiding this comment.
I don't like it named
_._means that it's not important but actually it's affectinganswervariable.
sorry for this silly mistake.
| @@ -0,0 +1,55 @@ | |||
| def is_geometric_series(series: list) -> bool: | |||
There was a problem hiding this comment.
Please add link with some theory about algorithm.
This reverts commit 11792ec.
|
@mateuszz0000 , I tried to resolve all the mistakes. I know you all guys are also busy, so if you get some time, then please review this PR . |
* geometric_mean3 * update-GM.PY * update-AM.PY * Revert "update-AM.PY" This reverts commit 11792ec.
* geometric_mean3 * update-GM.PY * update-AM.PY * Revert "update-AM.PY" This reverts commit 11792ec.
* geometric_mean3 * update-GM.PY * update-AM.PY * Revert "update-AM.PY" This reverts commit 11792ec.
Describe your change:
Added an algorithm to compute the geometric mean of series
Checklist:
Fixes: #{$ISSUE_NO}.