Book title | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Book title

Book Titles 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

8th Feb 2021, 1:42 PM
Hariharan GANESH RAMANI
Hariharan GANESH RAMANI - avatar
2 Answers
+ 2
hello ,use tags for language name and question title for actual question.
8th Feb 2021, 1:43 PM
Abhay
Abhay - avatar
+ 1
Use len() to find the length. Change it to string and then concatenate it with first letter. Copying somebody's solution in toto won'tt help you. Show us your attempt first so that suitable change can be suggested.
8th Feb 2021, 1:51 PM
CHANDAN ROY
CHANDAN ROY - avatar