Merge the Tools!

Sort by

recency

|

2655 Discussions

|

  • + 0 comments

    Vanilla.

    def merge_the_tools(string, k):
        for i in range(0, len(string), k):
            seen = set()
            out = ''
            for c in string[i: i + k]:
                if c in seen:
                    continue
                seen.add(c)
                out += c
            print(out)
    
  • + 2 comments

    I am not getting the challenge as solved, even though it was accepted and passed all the tests, does anyone also has this problem?

  • + 0 comments

    def merge_the_tools(string, k): for d in range(0,len(string),k): var = string[d: d+k] character ="".join(dict.fromkeys(var)) print(character)

    if name == 'main': string, k = input(), int(input()) merge_the_tools(string, k)

  • + 2 comments
    import textwrap
    from collections import OrderedDict
    
    def merge_the_tools(s, k):
        chunks = textwrap.wrap(s, k)
        for c in chunks:
            print("".join(OrderedDict.fromkeys(c)))
    
    def main():
        s, k = input(), int(input())
        merge_the_tools(s, k)
        
    if __name__ == "__main__":
        main()
    
  • + 0 comments
    def merge_the_tools(string, k):
        # your code goes here
        n = len(string)
        for i in range(0,n,k):
            word = ''
            for j in range(k):
                if string[i+j] not in word:
                    word+=string[i+j]
            print(word)