Skip to content

Commit 068020a

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 36e8085 commit 068020a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

maths/maclaurin_sin.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,20 @@ def maclaurin_sin(theta: float, accuracy: int = 30) -> float:
3838
ValueError: maclaurin_sin() requires int/float for theta and +ive int for accuracy
3939
"""
4040

41-
if not isinstance(accuracy, int) or accuracy <= 0 or type(theta) not in [int, float]:
42-
raise ValueError('maclaurin_sin() requires int/float for theta and +ive int for accuracy')
41+
if (
42+
not isinstance(accuracy, int)
43+
or accuracy <= 0
44+
or type(theta) not in [int, float]
45+
):
46+
raise ValueError(
47+
"maclaurin_sin() requires int/float for theta and +ive int for accuracy"
48+
)
4349

4450
theta = float(theta)
4551

4652
_total = 0
4753
for r in range(accuracy):
48-
_total += ((-1)**r)*((theta**(2*r+1))/(factorial(2*r+1)))
54+
_total += ((-1) ** r) * ((theta ** (2 * r + 1)) / (factorial(2 * r + 1)))
4955
return float(_total)
5056

5157

0 commit comments

Comments
 (0)