Skip to content

Commit cdd6d42

Browse files
author
rahini
committed
Fix TheAlgorithms#13226: consistent error handling for missing values
1 parent 93fc23b commit cdd6d42

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

coordinate_compression.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def compress(value):
2+
if value not in coordinate_map:
3+
raise ValueError(f"{value} not found in coordinate map")
4+
return coordinate_map[value]
5+
6+
def decompress(index):
7+
if index < 0 or index >= len(original_values):
8+
raise ValueError(f"Index {index} is out of bounds")
9+
return original_values[index]

0 commit comments

Comments
 (0)