0
Help me to solve s problem on python
You need to create a special categorization program that will assign a special code to each book depending on its title: The code is the first letter of the book title and the number of characters in the title. For example, the code for the book "Harry Potter" would look like this: H12, since the title consists of 12 characters (including spaces) You are given a books.txt file, the titles of the books are indicated on separate lines. You need to read the headings one by one and write the code for each book on separate lines. For example, if a books.txt file contains headers like this: Some kind of book Another book Your program should return the result: K14 D12
6 Antworten
+ 10
Rostik , sorry to say, but this it not an attempt. There are some lines of code missing. Please take some time and try to do your best. Then post it again. Thanks!
+ 3
This code shows all to read and write text files inclusive solution for your problem:
https://code.sololearn.com/cPeBWF4tkD8w/?ref=app
+ 2
attemp:
file = open("/usercode/files/books.txt", "r")
file.close()
+ 2
Rostik
You wrote "The code is the first letter of the book title and the number of the characters in the title."
Then how come "Some kind of book" gets K14 as a code. The same thing with "Another book" with D12. Am I not getting it right, or was that a typo? cause even the rule of "first letter of book title" isn't employed in those two examples 🤔
+ 2
JaScript this code is error
+ 1
Rostislav Khalilov Зачем? Я сдал это задание в курсе Питона.