subject

Please create a python module named homework. py and implement the functions outlined below. Below you will find an explanation for each function you need to implement. When you are done please upload the file homework. py to Grader Than. Please get started as soon as possible on this assignment. This assignment has many problems, it may take you longer than normal to complete this assignment. This assignment is supposed to test you on your understanding of reading and writing to a text file and working with JSON objects.
1. def read(file_path: str)->str:
"""
Reads the entire file at the specified file path. The function returns all the text in the file as a string, if
the file is empty it will return an empty string ("").
:param file_path: A path to a file
:return: All the text in the file
"""
2. def write(file_path:str, text:str=''):
"""
Clears the file at the specified file path then writes the specified line to the file. If the function is invoked
without a line parameter or the line variable is None nothing is written to the file but the file should still be
cleared. If the file does not exist a new file is created, regardless if a text is specified.
:param file_path: A path to a file
:param line: None
:return:
"""
3. def write_last_line(file_path:str, text:str=''):
"""
Writes the specified line to the file as the last line. If the text parameter does not start with a new line
character this adds a new line character to the text parameter so that the text is written on the next line of
the file. If the function is invoked without a line parameter or the line variable is None nothing is written to
the file. If the file does not exist a new file is created, regardless if a text is specified.
:param file_path: A path to a file
:param text: The last line to be written to the file.
:return: None
"""

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:50
Which is the best minecraft server? a. mineplex b. worldonecraft c. 9b9t d. 2b2t
Answers: 2
question
Computers and Technology, 23.06.2019 02:50
Define a class named movie. include private fields for the title,year, and name of the director. include three public functions withprototypes void movie: : settitle(cstring); , voidmovie: : setyear(int); , void movie: : setdirector(string); . includeanother function that displays all the information about a movie.write a main() function that declares a movie object namedmyfavoritemovie. set and display the object's fields.this is what i have but know its wrong since it will notcompile: #include#includeusing namespace std; //class declarationclass movie{private: string movietitle ; string movieyear; string directorname; public: void settitle(string title); void setyear(string year); void setdirector(string director); void displayinfo(); }; //class implementationvoid movie: : settitle(string title){ movietitle = title; cout< < "what is the title of themovie? "< > temp; myfavoritemovie.settitle(temp); cout< < "enter movie year"< > temp; myfavoritemovie.setyear(temp); cout< < "enter director'sname"< > temp; myfavoritemovie.setdirector(temp); //display all the data myfavoritemovie.displayinfo(); system("pause"); return 0; this code is not entirely mine someone on cramster edited my firstcode but then i try manipulating the new code and i still get acompile error message : \documents\visual studio 2008\projects\movie\movie\movie.cpp(46) : error c2679: binary '< < ' : no operator found which takes aright-hand operand of type 'std: : string' (or there is no acceptableconversion)c: \program files (x86)\microsoft visual studio9.0\vc\include\ostream(653): could be'std: : basic_ostream< _elem,_traits> & std: : operator< < > (std: : basic_ostream< _elem,_traits> & ,const char *)w
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
After you present a proposal, the committee starts asking you questions, some beyond the strict focus of your proposal. they ask questions about implications in other fields and knowledge about other fields. you are asked to redo your proposal. what is most likely missing? breadth of material depth of material clarity of material details of material
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Write a grading program for a class with the following grading policies: a. there are two quizzes, each graded on the basis of 10 points. b. there is one midterm exam and one final exam, each graded on the basis of 100 points. c. the final exam counts for 50% of the grade, the midterm counts for 25%, and the two quizzes together count for a total of 25%. (do not forget to normalize the quiz scores. they should be converted to a percentage before they are averaged in.) any grade of 90 or more is an a, any grade of 80 or more (but less than 90) is a b, any grade of 70 or more (but less than 80) is a c, any grade of 60 or more (but less than 70) is a d, and any grade below 60 is an f. the program will read in the student’s scores and output the student’s record, which consists of two quiz and two exam scores as well as the student’s average numeric score for the entire course and final letter grade. define and use a structure for the student reco
Answers: 2
You know the right answer?
Please create a python module named homework. py and implement the functions outlined below. Below y...
Questions
question
Mathematics, 14.10.2019 20:40
question
Chemistry, 14.10.2019 20:40
Questions on the website: 13722367