+ 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? 🙏
5 Antworten
+ 1
It's in python
+ 1
Ok, thank you
0
pick a language and do some string manipulation that all its easy. just try to think simple..
0
well you reached the first step.. i guess and that's as far i can help. because im a c# devoloper.
0
Try to use readlines method