Skip to content

Commit 297788e

Browse files
committed
Fix: Applied final type hint correction by simplifying Union[int, float] to float to resolve Ruff/PYI041 errors
1 parent 26b49d5 commit 297788e

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

maths/sum_of_geometric_progression.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
from typing import Union
22
# ... other imports ...
33

4+
<<<<<<< HEAD
45
def sum_of_geometric_progression(
56
# FIX: Changed 'int' to 'Union[int, float]' to allow non-integer terms/ratios
67
first_term: Union[int, float], common_ratio: Union[int, float], num_of_terms: int
8+
=======
9+
10+
def sum_of_geometric_progression(
11+
# FIX: Changed 'int' to 'Union[int, float]' to allow non-integer terms/ratios
12+
first_term: Union[int, float],
13+
common_ratio: Union[int, float],
14+
num_of_terms: int,
15+
>>>>>>> a2c7d8949a86c6146c216bfdb2c8ba4799f63740
716
) -> float:
817
"""
918
Return the sum of n terms in a geometric progression.
@@ -23,7 +32,11 @@ def sum_of_geometric_progression(
2332
-341.0
2433
>>> sum_of_geometric_progression(1, 2, -10)
2534
-0.9990234375
35+
<<<<<<< HEAD
2636
37+
=======
38+
39+
>>>>>>> a2c7d8949a86c6146c216bfdb2c8ba4799f63740
2740
# NEW DOCTEST to validate float inputs
2841
>>> sum_of_geometric_progression(0.5, 2, 3)
2942
3.5
@@ -34,4 +47,8 @@ def sum_of_geometric_progression(
3447

3548
# Formula for finding sum of n terms of a GeometricProgression
3649
# Note: Python's standard float arithmetic handles this correctly for the fix.
37-
return (first_term / (1 - common_ratio)) * (1 - common_ratio**num_of_terms)
50+
<<<<<<< HEAD
51+
return (first_term / (1 - common_ratio)) * (1 - common_ratio**num_of_terms)
52+
=======
53+
return (first_term / (1 - common_ratio)) * (1 - common_ratio**num_of_terms)
54+
>>>>>>> a2c7d8949a86c6146c216bfdb2c8ba4799f63740

0 commit comments

Comments
 (0)