All Algorithms implemented in Python the-algorithms.com/
Go to file
NIKITA PANDEY 238fe8c494
Update receive_file.py (#8541)
* Update receive_file.py

Here are the changes I made:

Added the main() function and called it from if __name__ == "__main__" block. This makes it easier to test the code and import it into other programs.
Added socket.AF_INET as the first argument to socket.socket(). This specifies the address family to be used, which is necessary when using connect().
Changed print(f"{data = }") to print("Received:", len(data), "bytes"). This makes it clearer what's happening and how much data is being received.
Changed the final print statement to "Successfully received the file". This makes it more accurate and descriptive.
Moved the import statement to the top of the file. This is a common convention in Python.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-03-31 16:08:13 +02:00
.github Fix broken links to Gitter Community (Fixes: #8197) (#8546) 2023-03-26 18:20:47 +02:00
arithmetic_analysis Replace bandit, flake8, isort, and pyupgrade with ruff (#8178) 2023-03-15 13:58:25 +01:00
audio_filters Replace flake8 with ruff (#8184) 2023-03-16 13:31:29 +01:00
backtracking Reduce the complexity of backtracking/word_search.py (#8166) 2023-03-10 15:18:05 +05:30
bit_manipulation add numbers different signs algorithm. (#8008) 2022-12-15 17:11:32 +13:00
blockchain pre-commit: Upgrade psf/black for stable style 2023 (#8110) 2023-02-01 18:44:54 +05:30
boolean_algebra clean of unnecessary checks, imports, calls (#7993) 2022-11-21 00:00:27 +13:00
cellular_automata clean of unnecessary checks, imports, calls (#7993) 2022-11-21 00:00:27 +13:00
ciphers Make some ruff fixes (#8154) 2023-03-01 17:23:33 +01:00
compression pre-commit: Upgrade psf/black for stable style 2023 (#8110) 2023-02-01 18:44:54 +05:30
computer_vision Update cnn_classification.py (#8570) 2023-03-30 07:09:21 +02:00
conversions pre-commit: Upgrade psf/black for stable style 2023 (#8110) 2023-02-01 18:44:54 +05:30
data_structures [pre-commit.ci] pre-commit autoupdate (#8294) 2023-03-20 22:16:13 +01:00
digital_image_processing Replace flake8 with ruff (#8184) 2023-03-16 13:31:29 +01:00
divide_and_conquer Remove some print statements within algorithmic functions (#7499) 2022-10-22 13:33:51 +02:00
dynamic_programming added a problem on kadane's algo and its solution. (#8569) 2023-03-31 13:17:13 +02:00
electronics Add circular convolution (#8158) 2023-03-07 17:16:25 +01:00
file_transfer Update receive_file.py (#8541) 2023-03-31 16:08:13 +02:00
financial Calculate GST Amount (#7694) 2022-10-26 23:15:02 +02:00
fractals pre-commit: Upgrade psf/black for stable style 2023 (#8110) 2023-02-01 18:44:54 +05:30
fuzzy_logic Misc fixes across multiple algorithms (#6912) 2022-10-16 10:55:38 +05:30
genetic_algorithm Fix yesqa hook (#7843) 2022-10-29 15:07:02 +02:00
geodesy pre-commit: Upgrade psf/black for stable style 2023 (#8110) 2023-02-01 18:44:54 +05:30
graphics The black formatter is no longer beta (#5960) 2022-01-30 20:29:54 +01:00
graphs Reduce the complexity of graphs/bi_directional_dijkstra.py (#8165) 2023-03-28 23:41:54 +02:00
greedy_methods Corrected the directory of Fractional Knapsack algorithm (#7086) 2022-10-16 22:41:28 +02:00
hashes New gitter link added or replaced (#8551) 2023-03-26 17:19:18 +02:00
knapsack pre-commit: Upgrade psf/black for stable style 2023 (#8110) 2023-02-01 18:44:54 +05:30
linear_algebra Make some ruff fixes (#8154) 2023-03-01 17:23:33 +01:00
machine_learning New gitter link added or replaced (#8551) 2023-03-26 17:19:18 +02:00
maths Replace flake8 with ruff (#8184) 2023-03-16 13:31:29 +01:00
matrix pre-commit: Upgrade psf/black for stable style 2023 (#8110) 2023-02-01 18:44:54 +05:30
networking_flow clean of unnecessary checks, imports, calls (#7993) 2022-11-21 00:00:27 +13:00
neural_network New gitter link added or replaced (#8551) 2023-03-26 17:19:18 +02:00
other Replace flake8 with ruff (#8184) 2023-03-16 13:31:29 +01:00
physics [pre-commit.ci] pre-commit autoupdate (#8177) 2023-03-13 23:18:35 +01:00
project_euler Fix broken links to Gitter Community (Fixes: #8197) (#8546) 2023-03-26 18:20:47 +02:00
quantum Replace flake8 with ruff (#8184) 2023-03-16 13:31:29 +01:00
scheduling Make some ruff fixes (#8154) 2023-03-01 17:23:33 +01:00
scripts Make some ruff fixes (#8154) 2023-03-01 17:23:33 +01:00
searches Make some ruff fixes (#8154) 2023-03-01 17:23:33 +01:00
sorts Replace bandit, flake8, isort, and pyupgrade with ruff (#8178) 2023-03-15 13:58:25 +01:00
strings Replace bandit, flake8, isort, and pyupgrade with ruff (#8178) 2023-03-15 13:58:25 +01:00
web_programming New gitter link added or replaced (#8551) 2023-03-26 17:19:18 +02:00
.gitattributes Create .gitattributes for Cross OS compatibility (#3410) 2020-10-17 07:25:25 +02:00
.gitignore chore: update .gitignore (#6263) 2022-07-23 07:56:59 +05:30
.gitpod.yml Change gitpod configuration for python3. (#1827) 2020-04-07 12:20:08 +02:00
.pre-commit-config.yaml New gitter link added or replaced (#8551) 2023-03-26 17:19:18 +02:00
CONTRIBUTING.md Fix broken links to Gitter Community (Fixes: #8197) (#8546) 2023-03-26 18:20:47 +02:00
DIRECTORY.md Add Project Euler problem 131 solution 1 (#8179) 2023-03-15 18:26:03 +05:30
LICENSE.md LICENSE: Year change (#5920) 2022-03-16 23:40:48 +08:00
pyproject.toml Reduce the complexity of graphs/bi_directional_dijkstra.py (#8165) 2023-03-28 23:41:54 +02:00
README.md Fix broken links to Gitter Community (Fixes: #8197) (#8546) 2023-03-26 18:20:47 +02:00
requirements.txt BB84 QKD algorithm (#7898) 2022-11-08 18:24:21 +01:00

The Algorithms - Python

Gitpod Ready-to-Code Contributions Welcome Discord chat Gitter chat
GitHub Workflow Status pre-commit code style: black

All algorithms implemented in Python - for education

Implementations are for learning purposes only. They may be less efficient than the implementations in the Python standard library. Use them at your discretion.

Getting Started

Read through our Contribution Guidelines before you contribute.

Community Channels

We are on Discord and Gitter! Community channels are a great way for you to ask questions and get help. Please join us!

List of Algorithms

See our directory for easier navigation and a better overview of the project.