We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7e51932 commit 2dfeac1Copy full SHA for 2dfeac1
maths/sum_of_squares.py
@@ -12,12 +12,12 @@
12
"""
13
14
15
-def sum_of_squares(n: int) -> int:
+def sum_of_squares(num_of_terms: int) -> int:
16
17
Implements the sum of squares formulafor the first n natural numbers.
18
19
Parameters:
20
- n (int): A positive integer representing the limit of the series
+ num_of_terms (int): A positive integer representing the limit of the series
21
22
Returns:
23
sum_squares (int): The sum of squares of the first n natural numbers.
@@ -29,7 +29,7 @@ def sum_of_squares(n: int) -> int:
29
>>> sum_of_squares(10)
30
385
31
32
- return n * (n + 1) * (2 * n + 1) // 6
+ return num_of_terms * (num_of_terms + 1) * (2 * num_of_terms + 1) // 6
33
34
35
if __name__ == "__main__":
0 commit comments