Skip to content

Commit d95d329

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 59fc97b commit d95d329

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
@@ -36,14 +36,20 @@ def maclaurin_sin(theta, accuracy=30):
3636
ValueError: maclaurin_sin() requires an int or float value for theta and positive int for accuracy
3737
"""
3838

39-
if not isinstance(accuracy, int) or accuracy <= 0 or type(theta) not in [int, float]:
40-
raise ValueError('maclaurin_sin() requires an int or float value for theta and positive int for accuracy')
39+
if (
40+
not isinstance(accuracy, int)
41+
or accuracy <= 0
42+
or type(theta) not in [int, float]
43+
):
44+
raise ValueError(
45+
"maclaurin_sin() requires an int or float value for theta and positive int for accuracy"
46+
)
4147

4248
theta = float(theta)
4349

4450
_total = 0
4551
for r in range(accuracy):
46-
_total += ((-1)**r)*((theta**(2*r+1))/(factorial(2*r+1)))
52+
_total += ((-1) ** r) * ((theta ** (2 * r + 1)) / (factorial(2 * r + 1)))
4753
return _total
4854

4955

0 commit comments

Comments
 (0)