Cody Bable

Generation

generate functionFri, 19 May 2023

create a function to split a string into pairs: "abcd" = "ab", "cd"

def split_string(string_to_split): return [string_to_split[i:i+2] for i in range(0, len(string_to_split), 2)] split_string("abcd")

Questions about programming?Chat with your personal AI assistant