Skip to content

Create Deflate.py #11865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions compression/Deflate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import zlib

Check failure on line 1 in compression/Deflate.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (N999)

compression/Deflate.py:1:1: N999 Invalid module name: 'Deflate'

# Data to compress
data = b"Hello, DEFLATE! This is an example of data compression using the DEFLATE algorithm."

Check failure on line 4 in compression/Deflate.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E501)

compression/Deflate.py:4:89: E501 Line too long (93 > 88)

# Compress the data using DEFLATE
compressed_data = zlib.compress(data)

# Decompress the data
decompressed_data = zlib.decompress(compressed_data)

# Output results
print(f"Original Data: {data}")
print(f"Compressed Data: {compressed_data}")
print(f"Decompressed Data: {decompressed_data}")

# Verify the decompressed data matches the original
assert data == decompressed_data, "Decompressed data does not match the original data!"
Loading