Book titles question in python. Help me out to get the output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Book titles question in python. Help me out to get the output

file = open("/usercode/files/books.txt", "r") #your code goes here for i in file: if i[-1]=="\n": print(i[0]+ str(len(i)-1)) else: print(i[0]+ str(len)) file.close()

27th Oct 2022, 7:29 AM
Kashish Khan
4 Answers
+ 4
https://code.sololearn.com/cW2J9gtkx4IT/?ref=app Here in else statement... You missed str(len(i))
27th Oct 2022, 8:16 AM
Riya
Riya - avatar
+ 1
You are provided a books.txt file, which includes the book titles, each one written on a separate line. Read the title one by one and output the code for each book on a separate line. For example, if the books.txt file contains: Some book Another book Your program should output: S9 A12
27th Oct 2022, 7:30 AM
Kashish Khan
+ 1
Ooops !!! Sometime we do shilly mistake. Btw thanks a lot
27th Oct 2022, 2:24 PM
Kashish Khan
0
This is the complete question ??
27th Oct 2022, 7:30 AM
Kashish Khan