+ 1
Why is the code i wrote for 'Book Titles' failing?
I can't pass the 4th project even my output is correct. Could you please explain why? file = open("/usercode/files/books.txt", "r") x = file.readlines() y = len(x) for i in range(y): A = x[i][0] B = x[i] z = len(B) - 1 print(A,z, sep="") file.close()
3 Réponses
+ 3
Last line doesn't contain '\n'. So subtract 1 from each line except the last one.