Ad
  • Custom User Avatar

    Ignore case

  • Default User Avatar

    The problem is that you are iterating through the characters of the lowercase version of your original, uncertainly cased string, and then checking how many times each of these lowercase characters appear on that original string. It's easy to see where this goes wrong.

    Adding this to the beginning of your function should fix it:

    word = word.lower()
    
  • Default User Avatar

    You can print to input to the console.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Please, read what this topic should be about:

    Solutions Grouping

    About

    This site will make an attempt to group similar solutions together so that they may be voted on and discussed as a group. If you have any feedback on how this process can be improved, this is the place to talk about it.

    If you want to discuss some kata in particular, there is a Discourse section for each one.

  • Custom User Avatar

    I trying the duplicate_encode kata for Python.

    Despite all test are ok, when trying the final attemp it gives me an error in the last test, it returns:

     '))(()())())' should equal '()(((())())'
    

    My code is:

     def duplicate_encode(word):
       nword=''
       for c in word.lower():nword+='(' if word.count(c)==1 else ')' 
       return nword
    

    I do not have feedback of the input that gives error. Can someone help me please?

    Thanks.