file = open("/usercode/files/books.txt", "r")  #your code goes here   file.close() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

file = open("/usercode/files/books.txt", "r")  #your code goes here   file.close()

You have been asked to make a special book categorization program, which assigns each book a special code based on its title. The code is equal to the first letter of the book, followed by the number of characters in the title. For example, for the book "Harry Potter", the code would be: H12, as it contains 12 characters (including the space). 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 Pls how do I solve this code? 🙏

2nd Jan 2022, 2:11 PM
Abiye Iniabere
Abiye Iniabere - avatar
5 Answers
+ 1
It's in python
2nd Jan 2022, 2:24 PM
Abiye Iniabere
Abiye Iniabere - avatar
+ 1
Ok, thank you
2nd Jan 2022, 2:27 PM
Abiye Iniabere
Abiye Iniabere - avatar
0
pick a language and do some string manipulation that all its easy. just try to think simple..
2nd Jan 2022, 2:24 PM
Ayan Poddar
Ayan Poddar - avatar
0
well you reached the first step.. i guess and that's as far i can help. because im a c# devoloper.
2nd Jan 2022, 2:26 PM
Ayan Poddar
Ayan Poddar - avatar
0
Try to use readlines method
3rd Jan 2022, 4:32 PM
Timur Askarov
Timur Askarov - avatar