Help me with this problem I'm a newbie here | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

Help me with this problem I'm a newbie here

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

30th Dec 2020, 6:57 PM
taabishhhhh
taabishhhhh - avatar
2 Respuestas
+ 13
Tabish Ansari , before we can help you, you should show us your attempt first. if you have not done a try by yourself upto now, please do so. Put your code in playground and link it here. Thanks!
30th Dec 2020, 7:01 PM
Lothar
Lothar - avatar
+ 3
first you will open() the file then you will read() the file and splitlines() then you will loop through each line and know its len() and finally you need to print out the first[0] letter of the name + the len().
30th Dec 2020, 11:51 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar