mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
Improve code on f-strings and brevity (#6126)
* Update strassen_matrix_multiplication.py * Update matrix_operation.py * Update enigma_machine2.py * Update enigma_machine.py * Update enigma_machine2.py * Update rod_cutting.py * Update external_sort.py * Update sol1.py * Update hill_cipher.py * Update prime_numbers.py * Update integration_by_simpson_approx.py
This commit is contained in:
@ -92,16 +92,12 @@ def simpson_integration(function, a: float, b: float, precision: int = 4) -> flo
|
||||
assert callable(
|
||||
function
|
||||
), f"the function(object) passed should be callable your input : {function}"
|
||||
assert isinstance(a, float) or isinstance(
|
||||
a, int
|
||||
), f"a should be float or integer your input : {a}"
|
||||
assert isinstance(function(a), float) or isinstance(function(a), int), (
|
||||
assert isinstance(a, (float, int)), f"a should be float or integer your input : {a}"
|
||||
assert isinstance(function(a), (float, int)), (
|
||||
"the function should return integer or float return type of your function, "
|
||||
f"{type(a)}"
|
||||
)
|
||||
assert isinstance(b, float) or isinstance(
|
||||
b, int
|
||||
), f"b should be float or integer your input : {b}"
|
||||
assert isinstance(b, (float, int)), f"b should be float or integer your input : {b}"
|
||||
assert (
|
||||
isinstance(precision, int) and precision > 0
|
||||
), f"precision should be positive integer your input : {precision}"
|
||||
|
Reference in New Issue
Block a user