Ad
  • Custom User Avatar

    It was likely intentional. Appending to a list is O(1), so they create the string only once at the end using 'join'. However, concatenating two strings creates a new string each time, which can be a costly operation.

  • Custom User Avatar

    It should output False because "nodwvdwdddw nmldw bdwi fobdwodw vdwfdww ldwudwjsdwm" - the string contains both dd and dw, which means d's best friend is inconsistent. I think in the later part of the comment you're referencing random tests - since these tests are generated randomly and not pre-programmed, it's important you provide as much information as you can when reporting them (what is the txt string? what is a? what is b? what leads you to believe it is blatantly wrong?). Lastly, based on your first sentence, please ensure that you're reading the error logs correctly - your_answer should equal expected_answer should be read in that order for Python. So the program is not telling you that you outputted False, but that you outputted True when it expected False.

  • Custom User Avatar

    What does your code return if a is equal to b. Read this: https://docs.codewars.com/training/troubleshooting