0
book titles project,
printing first letter of all words in a text file with characters count ex: manifest = m7 i tried but not getting the answer my code: file = open("book.txt") book=file.readlines() for i in book: print(i[0],len(i)-1) file.close()
3 Respostas
+ 2
try something like this,
name = "manifest"
print(name[0]+str(len(name[1:])))
name[0] gives the first letter of the word
we need to count the letters except the first so
we need to do this len(name[1:])
and finally we need to concat so first we need to convert int to string and done
+ 1
Tnx, Got it from here