Can you please help me to get the output of the book titles with the first letters concatenated ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can you please help me to get the output of the book titles with the first letters concatenated ?

https://code.sololearn.com/ceh97uVjhnhy/?ref=app

26th Sep 2022, 10:38 AM
Sanjay Kamath
Sanjay Kamath - avatar
4 Answers
+ 2
Task is print just first letter with length of title for each line of file. Except last line, all lines includes \n character, don't consider into length.
26th Sep 2022, 11:08 AM
Jayakrishna 🇮🇳
+ 3
Sanjay Kamath , there is more than one exercise related to *books*. please mention the tutorial name and the exercise name / number.
26th Sep 2022, 3:46 PM
Lothar
Lothar - avatar
27th Sep 2022, 4:00 AM
Sanjay Kamath
Sanjay Kamath - avatar
0
Do can do simply like this for the task: why to complicate? with open("/usercode/files/books.txt") as f: for line in f.readlines() : s ="" for l in line.split() : s += l[0] print(s) It can be more reduced also..Definitely in python. Using map with single loop. More ways,.
27th Sep 2022, 10:23 AM
Jayakrishna 🇮🇳