i Need help with python BOOK TITLES | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

i Need help with python BOOK TITLES

I am just starting out in puthon and I am stuck on the BOOK TITLES problem. I have used he FOR loop to iterate threw each line but I cannot get them to concatenate. I can get it to print out all the numbers of each byte in each seperate line, or i can get it to print the full book titles. But I cannot get it to print the first char. And then the reamining number of bytes in the sentence, except for the /n at the end of each line.... I need it to print the first character of each line and then the rest will be only bytes excluding the end line characters. I need a result of book titles that look like this ..this is input ==Happy Birthday . This is input==Alvin and the chipmunks I need output of......H14 A23 I am almost there but just need a little advice on what I should do. Please. Thanks for any advice. But please don’t give just the answer.

14th Nov 2020, 11:27 PM
MyOwnThoughts
MyOwnThoughts - avatar
4 Respuestas
+ 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
+ 5
Hey maybe you can look at this one and learn from the comments https://www.sololearn.com/Discuss/2589736/?ref=app
14th Nov 2020, 11:40 PM
Ipang
+ 2
yeah thats it, thanks
14th Nov 2020, 11:48 PM
MyOwnThoughts
MyOwnThoughts - avatar
20th Nov 2020, 12:54 PM
David Ashton
David Ashton - avatar