11from typing import Union
22# ... other imports ...
33
4+ < << << << HEAD
45def 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