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 21:00
Kirk found a local community college with a two-year program and he is comparing the cost with that of an out-of-state two-year school. what is the expected total cost for one year at the local community college if kirk lives at home? what is the expected total cost for one year at the out-of-state school if kirk lives on campus?
Answers: 2
question
Computers and Technology, 23.06.2019 01:50
Write a program that uses a random number generator to generate a two digit positive integer and allows the user to perform one or more of the following operations: a. double the number. b. reverse the digits of the number. c. raise the number to the power of 2, 3, or 4. d. sum the digits of the number. e. if the number is a two-digit number, then raise the first digit to the power of the second digit. f. if the number is a three-digit number and the last digit is less than or equal to 4, then raise the first two digits to the power of the last digit. after performing an operation if the number is less than 10, add 10 to the number. also, after each operation determine if the number is prime. each successive operation should be performed on the number generated by the last operation. your program should not contain any global variables and each of these operations must be implemented by a separate function. also, your program should be menu driven. 7. (fraction calculator) write a program that
Answers: 1
question
Computers and Technology, 24.06.2019 23:50
What is your fav video game currently: a) roblox b) fortnite c) apex legends d) pubg
Answers: 2
question
Computers and Technology, 25.06.2019 06:00
Me on this app how do you take a picture of your work
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
English, 14.10.2020 15:01
question
World Languages, 14.10.2020 15:01
question
History, 14.10.2020 15:01
question
English, 14.10.2020 15:01
Questions on the website: 13722363