Python Course Module Project - HELP!
For the problem below, I keep thinking I’m getting close by using a for statement to iterate through the lines of the file. I think I need to get the program to return two variables (first letter of the current list item and the character count of the current list item) then concatenate the two variables. But I can’t figure out how to return just the first letter of the given list item or the character count of the given list item. Any help greatly appreciated! Here is the problem: 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