Duplicate Encoders - Codewars Python

preview_player
Показать описание
Programming solution in Python for Duplicate encoders Kata in Codewars.
Рекомендации по теме
Комментарии
Автор

list comprehension would really shorten the code here:

def duplicate_encode(word):
word = word.lower()
lst_word = list(word)
return "".join(")" if list(word).count(letter) > 1 else "(" for letter in lst_word)

However it was a really good tutorial!

Rajsingh-rsyi
Автор

Thanks very much for the video. I have a question...For the test cases, why must we put word.lower() and list(word) first? If you don't the test cases don't pass.

lukebutler
join shbcf.ru