+ 1
Can you please help me to get the output of the book titles with the first letters concatenated ?
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.
+ 3
Sanjay Kamath ,
there is more than one exercise related to *books*. please mention the tutorial name and the exercise name / number.
+ 3
Thanks J. Solved.
https://code.sololearn.com/cp571LLEw9bo/?ref=app
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,.