Skip to content

[mypy] Fix type annotations for maths directory #5782

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 45 commits into from
Nov 7, 2021
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e34dd4d
[mypy] Fix annotations in `maths/series/p_series.py`
Rohanrbharadwaj Nov 6, 2021
cea397e
Update p_series.py
Rohanrbharadwaj Nov 6, 2021
7173166
Update p_series.py
Rohanrbharadwaj Nov 6, 2021
b5440ec
Remove from excluded in mypy.ini
Rohanrbharadwaj Nov 6, 2021
1ce55e7
Type annotation for series
Rohanrbharadwaj Nov 6, 2021
95e41dd
Annotate maths/proth_number.py (properly)
Rohanrbharadwaj Nov 6, 2021
4f00c09
Remove from excluded in mypy.ini
Rohanrbharadwaj Nov 6, 2021
99a0cf5
Annotate average_mode.py
Rohanrbharadwaj Nov 6, 2021
e9c81ab
Update average_mode.py
Rohanrbharadwaj Nov 6, 2021
d2a04cf
Update average_mode.py
Rohanrbharadwaj Nov 6, 2021
567210b
Update average_mode.py
Rohanrbharadwaj Nov 6, 2021
6b07a1f
Update average_mode.py
Rohanrbharadwaj Nov 6, 2021
175b785
Remove from excluded in mypy.ini
Rohanrbharadwaj Nov 6, 2021
9902c88
Fix annotations in gamma_recursive.py
Rohanrbharadwaj Nov 6, 2021
e52a293
Remove from excluded in mypy.ini
Rohanrbharadwaj Nov 6, 2021
e98c58e
Annotations for geometric_series.py
Rohanrbharadwaj Nov 6, 2021
83af001
Update geometric_series.py
Rohanrbharadwaj Nov 6, 2021
dc86c78
Update mypy.ini
Rohanrbharadwaj Nov 6, 2021
33b0977
Update average_mode.py
Rohanrbharadwaj Nov 7, 2021
9bbace1
Update average_mode.py
Rohanrbharadwaj Nov 7, 2021
bbfcc6e
Update average_mode.py
Rohanrbharadwaj Nov 7, 2021
dbc81e9
Update mypy.ini
Rohanrbharadwaj Nov 7, 2021
289c029
Update mypy.ini
Rohanrbharadwaj Nov 7, 2021
9f7c657
Update mypy.ini
Rohanrbharadwaj Nov 7, 2021
d384199
Update average_mode.py
Rohanrbharadwaj Nov 7, 2021
db95b64
Update proth_number.py
Rohanrbharadwaj Nov 7, 2021
ae56fe9
Update average_mode.py
Rohanrbharadwaj Nov 7, 2021
b610e7f
Update gamma_recursive.py
Rohanrbharadwaj Nov 7, 2021
882a12c
Update proth_number.py
Rohanrbharadwaj Nov 7, 2021
d645da0
Merge branch 'master' into patch-3
cclauss Nov 7, 2021
d112ce4
Update mypy.ini
cclauss Nov 7, 2021
dd1ff0a
Update geometric_series.py
Rohanrbharadwaj Nov 7, 2021
c416d74
Update average_mode.py
Rohanrbharadwaj Nov 7, 2021
a9d9c1e
Update proth_number.py
Rohanrbharadwaj Nov 7, 2021
85b0ba8
Update geometric_series.py
Rohanrbharadwaj Nov 7, 2021
5078821
Update geometric_series.py
Rohanrbharadwaj Nov 7, 2021
6bf7b4c
Update geometric_series.py
Rohanrbharadwaj Nov 7, 2021
8da52be
Update p_series.py
Rohanrbharadwaj Nov 7, 2021
db01780
Update geometric_series.py
Rohanrbharadwaj Nov 7, 2021
2e5cafb
Update p_series.py
Rohanrbharadwaj Nov 7, 2021
7508c25
Update p_series.py
Rohanrbharadwaj Nov 7, 2021
e8cb833
Update geometric_series.py
Rohanrbharadwaj Nov 7, 2021
bdb576d
Update p_series.py
Rohanrbharadwaj Nov 7, 2021
a362ea5
Update p_series.py
Rohanrbharadwaj Nov 7, 2021
f4597b5
Remove data_structures/stacks/next_greater_element.py|
cclauss Nov 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions maths/series/geometric_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
"""


from typing import Union


def geometric_series(
nth_term: float | int,
start_term_a: float | int,
common_ratio_r: float | int,
) -> list[float | int]:
nth_term: Union[float, int],
start_term_a: Union[float, int],
common_ratio_r: Union[float, int],
) -> list[Union[float, int]]:
"""
Pure Python implementation of Geometric Series algorithm

Expand Down Expand Up @@ -45,7 +48,7 @@ def geometric_series(
"""
if not all((nth_term, start_term_a, common_ratio_r)):
return []
series = []
series: list[Union[float, int]] = []
power = 1
multiple = common_ratio_r
for _ in range(int(nth_term)):
Expand All @@ -62,11 +65,3 @@ def geometric_series(
import doctest

doctest.testmod()

nth_term = float(input("Enter the last number (n term) of the Geometric Series"))
start_term_a = float(input("Enter the starting term (a) of the Geometric Series"))
common_ratio_r = float(
input("Enter the common ratio between two terms (r) of the Geometric Series")
)
print("Formula of Geometric Series => a + ar + ar^2 ... +ar^n")
print(geometric_series(nth_term, start_term_a, common_ratio_r))