I have a question about Lesson 51 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I have a question about Lesson 51

file = open("/usercode/files/books.txt", "r") list = file.readlines() for i in list: print (i[0]+str(len(i.strip())) file.close() This is my code and I keep getting errors that say "Invalid Syntax" on line 7. What is wrong with "file.close(0)"?

29th Apr 2022, 2:42 PM
Noel K
2 Answers
+ 3
Your print statement is missing a closing parenthesis.
29th Apr 2022, 2:45 PM
Simon Sauter
Simon Sauter - avatar
0
Oh thanks. I didn't see that
29th Apr 2022, 2:48 PM
Noel K