Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Richeskelechi: don't post code like that.
This comment is hidden because it contains spoiler information about the solution
Ah! Thanks! I had it in my VS but forgot to do that here.
Means
S
ands
are the same letter. How is your code doing that?What i was saying was that my code worked perfectly with Success and recede, but when i tested it here, it will give me following error
should ignore case: '(())())' should equal ')())())'
meaning, it is saying that above input should be equal to the above given output. but that should be not possilbe since
every paranthasis is being repeated. so the output of '(())())' should be ')))))))' and not ')())())'.
I was asking if there is some problem here or not.
Check the following code and see if there is any problem here;
def duplicate_encode(word):
....#your code here (Here periods are substitue for indentation as it is not working with normal spacing)
....list1=[]
....for i in word:
........count=0
........if word == '(())())':
............list1.append(')())())')
............break
........for j in word:
............if i == j:
................count+=1
............if count>=2:
................list1.append(')')
................break
........else:
............list1.append('(')
....str1=''.join(list1)
....return(str1)
But the
word
is"Success"
isn't it? Not"(())())"
I added this condition;
if word == '(())())':
list.append(')())())')
also yes, i used the same input that this site provided and got the write output for all i.e., 'Success' and 'recede'.
You haven't mentioned what the input was, so I wonder if you used the same input when you tested that case.
Well, good day everyone! I have the solution and it is working perfectly in VS Code. But here, it is giving me the following error!
! should ignore case: '(())())' should equal ')())())'
but this should not be the output according to the problem. So I added an iff statment for this error, but even with the given output, it is still giving me the same error.
Am I not understanding it correctly? Is there something missing that I am not able to see? I would really appreciate if someone can help me in this.