File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -36,14 +36,20 @@ def maclaurin_sin(theta, accuracy=30):
36
36
ValueError: maclaurin_sin() requires an int or float value for theta and positive int for accuracy
37
37
"""
38
38
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
+ )
41
47
42
48
theta = float (theta )
43
49
44
50
_total = 0
45
51
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 )))
47
53
return _total
48
54
49
55
You can’t perform that action at this time.
0 commit comments