Is Book Titles assignment in Python broken? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is Book Titles assignment in Python broken?

I solved the assignment Book Titles, the output is correct but still the test isn't passed, why is that? I thought I made it even cooler making it a function :-/ https://code.sololearn.com/cN9Nx3f9by8j/?ref=app

19th Oct 2020, 4:40 AM
Gabriele Profita
Gabriele Profita - avatar
3 Answers
+ 2
A simpler way with 5 lines of code. A simple explanation, loop through all lines, and if a line has trailing/ending "\n" remove it from the count of the length. https://code.sololearn.com/cdaPdMWWeN3W/?ref=app
15th Dec 2020, 6:43 PM
Lam Wei Li
Lam Wei Li - avatar
+ 1
All lines, except the last one!!!, contain a \n at the end
19th Oct 2020, 5:19 AM
Nikolai Ivanov
Nikolai Ivanov - avatar
0
Thanks Nikolai, fixed it so that last line doesn't count the \n, now the test is passed, anyway there is some bug because even before changing it the expected result was the same as my output, with the difference it failed.
19th Oct 2020, 7:12 AM
Gabriele Profita
Gabriele Profita - avatar