mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 10:28:39 +00:00
Merge branch 'master' of github.com:amirsoroush/PythonAlgorithms into bug-fix-expression-tree
This commit is contained in:
commit
01aebb0270
@ -16,7 +16,7 @@ repos:
|
||||
- id: auto-walrus
|
||||
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: v0.0.261
|
||||
rev: v0.0.262
|
||||
hooks:
|
||||
- id: ruff
|
||||
|
||||
@ -33,7 +33,7 @@ repos:
|
||||
- tomli
|
||||
|
||||
- repo: https://github.com/tox-dev/pyproject-fmt
|
||||
rev: "0.9.2"
|
||||
rev: "0.10.0"
|
||||
hooks:
|
||||
- id: pyproject-fmt
|
||||
|
||||
|
@ -327,6 +327,7 @@
|
||||
* [Minimum Coin Change](dynamic_programming/minimum_coin_change.py)
|
||||
* [Minimum Cost Path](dynamic_programming/minimum_cost_path.py)
|
||||
* [Minimum Partition](dynamic_programming/minimum_partition.py)
|
||||
* [Minimum Size Subarray Sum](dynamic_programming/minimum_size_subarray_sum.py)
|
||||
* [Minimum Squares To Represent A Number](dynamic_programming/minimum_squares_to_represent_a_number.py)
|
||||
* [Minimum Steps To One](dynamic_programming/minimum_steps_to_one.py)
|
||||
* [Minimum Tickets Cost](dynamic_programming/minimum_tickets_cost.py)
|
||||
@ -339,6 +340,7 @@
|
||||
* [Word Break](dynamic_programming/word_break.py)
|
||||
|
||||
## Electronics
|
||||
* [Apparent Power](electronics/apparent_power.py)
|
||||
* [Builtin Voltage](electronics/builtin_voltage.py)
|
||||
* [Carrier Concentration](electronics/carrier_concentration.py)
|
||||
* [Circular Convolution](electronics/circular_convolution.py)
|
||||
@ -348,6 +350,7 @@
|
||||
* [Electrical Impedance](electronics/electrical_impedance.py)
|
||||
* [Ind Reactance](electronics/ind_reactance.py)
|
||||
* [Ohms Law](electronics/ohms_law.py)
|
||||
* [Real And Reactive Power](electronics/real_and_reactive_power.py)
|
||||
* [Resistor Equivalence](electronics/resistor_equivalence.py)
|
||||
* [Resonant Frequency](electronics/resonant_frequency.py)
|
||||
|
||||
@ -483,6 +486,7 @@
|
||||
* [Astar](machine_learning/astar.py)
|
||||
* [Data Transformations](machine_learning/data_transformations.py)
|
||||
* [Decision Tree](machine_learning/decision_tree.py)
|
||||
* [Dimensionality Reduction](machine_learning/dimensionality_reduction.py)
|
||||
* Forecasting
|
||||
* [Run](machine_learning/forecasting/run.py)
|
||||
* [Gradient Descent](machine_learning/gradient_descent.py)
|
||||
@ -604,6 +608,7 @@
|
||||
* [Perfect Number](maths/perfect_number.py)
|
||||
* [Perfect Square](maths/perfect_square.py)
|
||||
* [Persistence](maths/persistence.py)
|
||||
* [Pi Generator](maths/pi_generator.py)
|
||||
* [Pi Monte Carlo Estimation](maths/pi_monte_carlo_estimation.py)
|
||||
* [Points Are Collinear 3D](maths/points_are_collinear_3d.py)
|
||||
* [Pollard Rho](maths/pollard_rho.py)
|
||||
|
@ -76,10 +76,11 @@ def encrypt_and_write_to_file(
|
||||
key_size, n, e = read_key_file(key_filename)
|
||||
if key_size < block_size * 8:
|
||||
sys.exit(
|
||||
"ERROR: Block size is %s bits and key size is %s bits. The RSA cipher "
|
||||
"ERROR: Block size is {} bits and key size is {} bits. The RSA cipher "
|
||||
"requires the block size to be equal to or greater than the key size. "
|
||||
"Either decrease the block size or use different keys."
|
||||
% (block_size * 8, key_size)
|
||||
"Either decrease the block size or use different keys.".format(
|
||||
block_size * 8, key_size
|
||||
)
|
||||
)
|
||||
|
||||
encrypted_blocks = [str(i) for i in encrypt_message(message, (n, e), block_size)]
|
||||
@ -101,10 +102,11 @@ def read_from_file_and_decrypt(message_filename: str, key_filename: str) -> str:
|
||||
|
||||
if key_size < block_size * 8:
|
||||
sys.exit(
|
||||
"ERROR: Block size is %s bits and key size is %s bits. The RSA cipher "
|
||||
"ERROR: Block size is {} bits and key size is {} bits. The RSA cipher "
|
||||
"requires the block size to be equal to or greater than the key size. "
|
||||
"Did you specify the correct key file and encrypted file?"
|
||||
% (block_size * 8, key_size)
|
||||
"Did you specify the correct key file and encrypted file?".format(
|
||||
block_size * 8, key_size
|
||||
)
|
||||
)
|
||||
|
||||
encrypted_blocks = []
|
||||
|
@ -399,7 +399,7 @@ def main():
|
||||
if input("Press any key to restart or 'q' for quit: ").strip().lower() == "q":
|
||||
print("\n" + "GoodBye!".center(100, "-") + "\n")
|
||||
break
|
||||
system("cls" if name == "nt" else "clear")
|
||||
system("clear" if name == "posix" else "cls") # noqa: S605
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
x
Reference in New Issue
Block a user