0

Somebady help me?

You need to make a special 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, since it contains 12 characters (including space) You are given a books.txt file, which includes the title of the book, each written on a separate line. You have to read the title one by one and draw the code for each book on a separate line. For example, if the books.txt file contains: Some book Another book Your program should generate: S9 A12

12th Feb 2021, 9:34 AM
Carlos Quiala
Carlos Quiala - avatar
5 odpowiedzi
+ 7
Carlos Quiala , before we can help you, you should present your attempt here. if you have done no try by yourself, please do so. put your code in playground and link it here. thanks!
12th Feb 2021, 10:04 AM
Lothar
Lothar - avatar
+ 4
Carlos Quiala - ok. can you give a description of the problem you have? thanjs!
12th Feb 2021, 8:37 PM
Lothar
Lothar - avatar
+ 1
What do you need help with?
12th Feb 2021, 9:41 AM
Abhay
Abhay - avatar
0
I try this: ile = open("/usercode/files/books.txt", "r") for line in file.readlines(): print(line[0] + str(len(line)-1)) file.close()
12th Feb 2021, 4:34 PM
Carlos Quiala
Carlos Quiala - avatar
0
The first messages is the description
12th Feb 2021, 8:59 PM
Carlos Quiala
Carlos Quiala - avatar