Skip to content

Commit d44d0a8

Browse files
committed
safe eval used
1 parent aa66c4b commit d44d0a8

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

maths/weddles_rule.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,15 @@ def compute_solution(add: list, table: list, step_size: float) -> float:
135135

136136
testmod()
137137

138-
# func, a, b = get_inputs()
139-
# acc = 1
140-
# solution = None
141-
142-
# while acc <= 100_000:
143-
# table, h = compute_table(func, a, b, acc)
144-
# add = apply_weights(table)
145-
# solution = compute_solution(add, table, h)
146-
# acc *= 10
147-
148-
# print(f'Solution: {solution}')
138+
func_str, a, b = get_inputs()
139+
acc = 1
140+
solution = None
141+
142+
func = safe_function_eval(func_str)
143+
while acc <= 100_000:
144+
table, h = compute_table(func, a, b, acc)
145+
add = apply_weights(table)
146+
solution = compute_solution(add, table, h)
147+
acc *= 10
148+
149+
print(f'Solution: {solution}')

0 commit comments

Comments
 (0)