0

Someone please help. It’s urgent. 😭

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 I tried the print(file.readlines(H12)) and for line in file method. Still it’s failing 😭

10th Feb 2021, 7:52 PM
Dannyfame
2 Respuestas
+ 5
Why is it urgent ? Also can you share the link to your code so we see what you have done .
10th Feb 2021, 7:54 PM
Abhay
Abhay - avatar
+ 1
first you should read the file with split way then loop throw each line and get line length then you can print out line first index with line length and don’t forget to close the file
10th Feb 2021, 8:31 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar