Skip to content

Commit 45a1b19

Browse files
committed
remove a variable with named langht
1 parent 6c4ad2b commit 45a1b19

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

graphs/array_to_graph.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ def divide_array_to_graph(arr: list[int], base: int) -> dict[int, list[int]]:
3434
>>> divide_array_to_graph(arr=[1, 2, 3, 4, 5, 6, 7, 8], base=3)
3535
{0: [1, 2, 3, 4], 1: [5, 6, 7, 8]}
3636
"""
37-
length = len(arr)
3837
parts = len(arr) // base # Desired number of parts
39-
part_size = length // parts # Size of each part
38+
part_size = len(arr) // parts # Size of each part
4039

4140
# Divide the array into smaller parts
4241
result = [arr[i * part_size : (i + 1) * part_size] for i in range(parts)]
@@ -50,7 +49,7 @@ def divide_array_to_graph(arr: list[int], base: int) -> dict[int, list[int]]:
5049
if __name__ == "__main__":
5150
# Example usage
5251
array = [1, 2, 3, 4, 5, 6, 7, 8]
53-
print(divide_array_to_graph(array, 2))
52+
print(divide_array_to_graph(array, 3))
5453

5554
import doctest
5655

0 commit comments

Comments
 (0)