Merge the Tools!

  • + 0 comments

    It is a little lengthy but worked for me

    def merge_the_tools(string, k): # your code goes here st = string sub_string_list = [] for i in range(int(len(st)/k)): sub_string = "" count = i for j in range(k): sub_string += st[count*k + j] sub_string_list.append(sub_string)

    for i in range(len(sub_string_list)):
        string_dict = {}
        formatted_str = ""
        for j in range(k):
            if sub_string_list[i][j] not in string_dict:
                formatted_str += sub_string_list[i][j]
                string_dict[sub_string_list[i][j]] = 1
        sub_string_list[i] = formatted_str
    for i in sub_string_list:
        print(i)