Why this code is not correct for Python3 5th project??? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 Réponse
+ 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