Wissen Technology processes ordered event records in batches. Given an array and a positive chunk size, split the array into consecutive, non-empty chunks while preserving the original order and leaving the input array unchanged.
Implement split_into_chunks(records, chunk_size).
records is a Python list containing arbitrary values.chunk_size is a positive integer.chunk_size consecutive elements from records.chunk_size elements.records is empty.Example 1
Input: records = [1, 2, 3, 4, 5, 6, 7], chunk_size = 3
Output: [[1, 2, 3], [4, 5, 6], [7]]
The first two chunks contain three elements, and the remaining element forms the final chunk.
Example 2
Input: records = ["a", "b"], chunk_size = 5
Output: [["a", "b"]]
Because the requested size exceeds the array length, the entire array becomes one chunk.
0 <= len(records) <= 10^51 <= chunk_size <= 10^5records.def split_into_chunks(records, chunk_size):