Title Encoder - Intermediate Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Title Encoder - Intermediate Python

I’m having some trouble with the last Code Project for the Intermediate Python course. The only test case is hidden so I can’t see what error I’m making. How do I change the code to pass the test case? file = open("/usercode/files/books.txt", "r") for x in file: title=x.split() for a in title: print(a[0],end='') print() file.close()

29th Nov 2022, 8:32 PM
Lashana Jegatheswaran
2 Answers
+ 2
rl = file.readlines() for r in rl: sp = r.split() p = "" for s in sp: p += s[0] print(p)
29th Nov 2022, 11:03 PM
SoloProg
SoloProg - avatar
+ 1
Thank you so much!
29th Nov 2022, 11:30 PM
Lashana Jegatheswaran