10 Answers
New AnswerBro check this out... https://code.sololearn.com/cpLd69M99SJy/?ref=app Happy Coding...
https://code.sololearn.com/c5LfMwEmIx2v/?ref=app compare your code with this one👆🏻
trying to print string chac and count the length of the content so that able print out as per sample output
This is a possible solution for this problem with open("/usercode/files/books.txt", "r") as file: lista = [x.strip() for x in file.readlines()] for element in lista: print('{}{}'.format(element[0], len(element)), sep='\n')
given file = open(“/usercode/files/books.txt” , “r”) f = file.read() print(file.read()) title = “str()”+ len() print(title) file.close()
sample output should be like read txt file content and print out like below “Harry Potter” output: H12
file = open("/usercode/files/books.txt", "r") #your code goes here books=file.readlines() for i in books: if i==books[-1]: value=len(i) else: value=len(i)-1 print(i[0]+str(value)) file.close()
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message