Skip to content

Commit 7ce066c

Browse files
committed
added return type hint
1 parent 162595b commit 7ce066c

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

maths/weddles_rule.py

+17-17
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from sympy import lambdify, symbols, sympify
33

44

5-
def get_inputs():
5+
def get_inputs() -> tuple:
66
"""
77
Get user input for the function, lower limit, and upper limit.
88
@@ -23,7 +23,7 @@ def get_inputs():
2323
return func, a, b
2424

2525

26-
def safe_function_eval(func_str):
26+
def safe_function_eval(func_str) -> float:
2727
"""
2828
Safely evaluates the function by substituting x value using sympy.
2929
@@ -41,7 +41,7 @@ def safe_function_eval(func_str):
4141
return lambda_func
4242

4343

44-
def compute_table(func, a, b, acc):
44+
def compute_table(func, a, b, acc) -> tuple:
4545
"""
4646
Compute the table of function values based on the limits and accuracy.
4747
@@ -71,7 +71,7 @@ def compute_table(func, a, b, acc):
7171
return table, h
7272

7373

74-
def apply_weights(table):
74+
def apply_weights(table) -> list:
7575
"""
7676
Apply Simpson's rule weights to the values in the table.
7777
@@ -98,7 +98,7 @@ def apply_weights(table):
9898
return add
9999

100100

101-
def compute_solution(add, table, h):
101+
def compute_solution(add, table, h) -> float:
102102
"""
103103
Compute the final solution using the weighted values and table.
104104
@@ -122,15 +122,15 @@ def compute_solution(add, table, h):
122122
from doctest import testmod
123123

124124
testmod()
125-
126-
func, a, b = get_inputs()
127-
acc = 1
128-
solution = None
129-
130-
while acc <= 100_000:
131-
table, h = compute_table(func, a, b, acc)
132-
add = apply_weights(table)
133-
solution = compute_solution(add, table, h)
134-
acc *= 10
135-
136-
print(f"Solution: {solution}")
125+
126+
# func, a, b = get_inputs()
127+
# acc = 1
128+
# solution = None
129+
130+
# while acc <= 100_000:
131+
# table, h = compute_table(func, a, b, acc)
132+
# add = apply_weights(table)
133+
# solution = compute_solution(add, table, h)
134+
# acc *= 10
135+
136+
# print(f'Solution: {solution}')

0 commit comments

Comments
 (0)