+ 1
1. You can use a context manager (no need to worry about closing the file, it will be handled for you)
with open('filename', 'r') as file:
2. Then use a for loop to loop through the lines of the file. (You don't actually need to use readlines() or read() here, but you can if preferred)
for line in file:
3. Output the first char of the line (line[0]) and then use the strip() method to remove the trailing newline character '\n' from the line before outputting its len(). You can either concatenate the string or use an f-string for the output.
print(f"{line[0]}{len(line.strip())}")



