Why this code is not correct for Python3 5th project??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why this code is not correct for Python3 5th project???

Here's the code: file = open("/usercode/files/books.txt", "r") #your code goes here for line in file: print(line[0]+str(len(line)-1)) file.close()

12th Dec 2020, 3:14 PM
Vishal Kumar
1 Answer
+ 4
you forgot about the file function. read, which returns the contents of the file as a string
12th Dec 2020, 3:17 PM
Иван Чикyнов
Иван Чикyнов - avatar