Skip to content
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

# 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