diff --git a/pyfiles/__pycache__/factorial.cpython-310.pyc b/pyfiles/__pycache__/factorial.cpython-310.pyc new file mode 100644 index 0000000..f63c394 Binary files /dev/null and b/pyfiles/__pycache__/factorial.cpython-310.pyc differ diff --git a/pyfiles/__pycache__/trigonometry.cpython-310.pyc b/pyfiles/__pycache__/trigonometry.cpython-310.pyc new file mode 100644 index 0000000..67c7c0a Binary files /dev/null and b/pyfiles/__pycache__/trigonometry.cpython-310.pyc differ diff --git a/pyfiles/factorial.py b/pyfiles/factorial.py index d55fc91..c1f3abe 100644 --- a/pyfiles/factorial.py +++ b/pyfiles/factorial.py @@ -1,11 +1,13 @@ def factorial(x): -    ans = 1 - -    if x < 0: -        raise ValueError('x must be greater than 0') - -    for i in range(1, x+1): -        ans *= i -     -    return ans + ans = 1 + + if x < 0: + + raise ValueError('x must be greater than 0') + + for i in range(1, x+1): + + ans *= i + + return ans diff --git a/pyfiles/test.py b/pyfiles/test.py index 30f42ed..94e0182 100644 --- a/pyfiles/test.py +++ b/pyfiles/test.py @@ -4,5 +4,6 @@ import math pi = math.pi print('pi:', pi) for alpha in [0, pi, pi/2, pi/3, pi/4, pi/6]: -    print(f'For angle: {0 if alpha == 0 else "pi/"+str(int(pi/alpha))}, Sine  is ~ {sin(alpha)}') + print(f'For angle: {0 if alpha == 0 else "pi/"+str(int(pi/alpha))}, Sin is ~ {sin(alpha)}') +#    print(f'For angle: {0 if alpha == 0 else "pi/"+str(int(pi/alpha))}, Sine  is ~ {sin(alpha)}') diff --git a/pyfiles/trigonometry.py b/pyfiles/trigonometry.py index 8a1c243..a84ca4e 100644 --- a/pyfiles/trigonometry.py +++ b/pyfiles/trigonometry.py @@ -1,6 +1,6 @@ from factorial import factorial as fct def sin(x): -    sin = 1 - (x**2/fct(2)) + (x**4/fct(4)) - (x**6/fct(6)) + (x**8/fct(8)) - (x**10/fct(10)) -    return round(sin, 5) + sin = 1 - (x**2/fct(2)) + (x**4/fct(4)) - (x**6/fct(6)) + (x**8/fct(8)) - (x**10/fct(10)) + return round(sin, 5)