0

Python Project

file = open("/usercode/files/books.txt", "r") #your code goes here file.close() I need to read the title one by one and output the code for each book on a separate line .

14th Jun 2022, 9:33 AM
Mbalenhle Shamima Nhlapo
Mbalenhle Shamima Nhlapo - avatar
9 Respostas
+ 6
Baribor Saturday , (your code sample does not meet the requirements of the task description, and it is just a code without any comments / descriptions) please do not give codes to the ops. this does not help to improve the coding ability and gaining the experience. you also take away the opportunity for the op to improve himself and to develop further. better to give hints or a description how the task can be solved. this a sample how to support the op: https://code.sololearn.com/c3JEh3fi2VdK/?ref=app
14th Jun 2022, 11:22 AM
Lothar
Lothar - avatar
+ 3
Attemps?
14th Jun 2022, 9:50 AM
A͢J
A͢J - avatar
+ 3
Repeating the question does not help. We have not seen an attempt from you https://www.sololearn.com/Discuss/3046302/?ref=app
14th Jun 2022, 9:53 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Mbalenhle Shamima Nhlapo file is an object so you cannot write (in file) As explanation is already given Use readlines function to read file, which will return list of books. Now as description says output should be first character + no_of_characters of books but each book contains \n in the last which should be replace by a space. For example: Harry Potter So first character is H and length is 12 so H12
14th Jun 2022, 10:19 AM
A͢J
A͢J - avatar
+ 1
Mbalenhle Shamima Nhlapo You have to read file not write file. Check previous lesson again.
14th Jun 2022, 9:56 AM
A͢J
A͢J - avatar
+ 1
Lothar Okay. I thought that was just a personal work
14th Jun 2022, 11:25 AM
Baribor Saturday
Baribor Saturday - avatar
0
file = open("/usercode/files/books.txt", "r") for i in file: file.write(i+ "\n") file.close()
14th Jun 2022, 9:54 AM
Mbalenhle Shamima Nhlapo
Mbalenhle Shamima Nhlapo - avatar
0
Here is my attempt i was trying to post it here
14th Jun 2022, 9:55 AM
Mbalenhle Shamima Nhlapo
Mbalenhle Shamima Nhlapo - avatar
0
I am looking at my previous lessons i am clearly trying and failing thats why i am asking for help , if i knew what i was doing i would not be asking
14th Jun 2022, 9:58 AM
Mbalenhle Shamima Nhlapo
Mbalenhle Shamima Nhlapo - avatar