+ 1

Flowing Words

Hi, I'm having problems with the coad coach. All test cases pass except number 3. What could be wrong in my code? https://sololearn.com/compiler-playground/cID535559W0x/?ref=app

11th Oct 2024, 2:08 PM
Blight
Blight - avatar
7 Antworten
+ 4
your recursive function needs to return something. Look at line 13: https://sololearn.com/compiler-playground/cX51ikJlJo7l/?ref=app
11th Oct 2024, 5:50 PM
Lisa
Lisa - avatar
+ 3
BroFar The instruction says to return these strings – not Python's booleans. If you look at the input line, you'll note that the words are checked in reverse order. Hence, the logic works.
11th Oct 2024, 6:13 PM
Lisa
Lisa - avatar
+ 2
Anonimsus Found 4 issues The code has several issues that prevent it from working correctly: Incorrect logic for checking flow: The code checks if the last letter of the current word matches the first letter of the previous word, but it does this in reverse order (from the end of the sentence to the beginning). This leads to incorrect results. Inefficient use of lists: The code repeatedly converts strings to lists and back, which is unnecessary and inefficient. Redundant checks: The code checks if the length of the input string is not 0 or 1, but this is already implied by the condition n > 0. Incorrect return values: The code returns "true" or "false" as strings instead of boolean values.
11th Oct 2024, 6:02 PM
BroFar
BroFar - avatar
+ 1
Try to use for loop
11th Oct 2024, 5:09 PM
Aysha
Aysha - avatar
+ 1
Already tried that and it didn't work. Case number 3 should be "false" but I don't know if it outputs "true" or nothing at all
11th Oct 2024, 5:47 PM
Blight
Blight - avatar
+ 1
11th Oct 2024, 6:56 PM
BroFar
BroFar - avatar