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 16:30
Corey set up his presentation for delivery to his team.the information he had to convey was critical to their job performance.he knew he would need a lot of time to explain each point
Answers: 3
question
Computers and Technology, 23.06.2019 06:00
Respond to the following in three to five sentences. select the workplace skill, habit, or attitude described in this chapter that you believe is most important for being a successful employee.
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
In which view can you see speaker notes?
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Read these lines from beowulf.often scyld scefing seized mead-benches from enemytroops, from many a clan, he terrified warriors, even thoughfirst he was found a waif, best explains why the author includes this information in theexposition? a. to emphasize that a hero must learn to be fierceb. to remember the famous story of a popular heroc. to express sadness about losing the old heroesd. to see whether people still respect the old heroes
Answers: 1
You know the right answer?
Please create a python module named homework. py and implement the functions outlined below. Below y...
Questions
question
History, 28.01.2021 22:40
question
Mathematics, 28.01.2021 22:40
question
Mathematics, 28.01.2021 22:40
question
Mathematics, 28.01.2021 22:40
question
Mathematics, 28.01.2021 22:40
Questions on the website: 13722363