Day: May 16, 2022

  • Python Kata on Codewars

    Hi,

    Since I pretty much broke the internet trying to solve the following “kata” with pieces of code, lets paste it also here cause it makes me proud.

    Here is the link to the kata: https://www.codewars.com/kata/5977ef1f945d45158d00011f

    And also here is my “solution” which took quite a long time to fix:

    def sep_str(st): 
        # your code here
        test_list = [[letter for letter in element] for element in st.split()]
        for a in test_list:
            a.extend([""] * (max(map(len, test_list)) - len(a)))
        if test_list:    
            result = [[test_list[j][i] for j in range(len(test_list))] for i in range(len(test_list[0]))]
        else:
            result = []
        return result

    That is all.

    Cheers!