Created
July 5, 2019 11:08
-
-
Save Ashaba/034ccf9136fcb945d644c6b4210b40e1 to your computer and use it in GitHub Desktop.
A function that merges two arrays together at a given length creating one array array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def merge_arrays(a, b, c): | |
index = 0 | |
b_index = 0 | |
b_len = len(b) | |
d = [] | |
for i in a: | |
d.append(i) | |
index += 1 | |
if index == c: | |
if b_index < b_len: | |
d.append(b[b_index]) | |
b_index += 1 | |
index = 0 | |
while b_index < b_len: | |
d.append(b[b_index]) | |
b_index += 1 | |
return d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment