Question: PYTHON ONLY Please follow all the directions and code using Python idle and make sure not to use the constructs prohibited in the list unless

PYTHON ONLY

PYTHON ONLY Please follow all the directions and code using Python idle

and make sure not to use the constructs prohibited in the listunless the question at the top asks you to use that construct.

Please follow all the directions and code using Python idle and make sure not to use the constructs prohibited in the list unless the question at the top asks you to use that construct. Also, do not use

if __name__ == "__main__":

main()

Instead, just invoke the main function normally.

1. create_file - takes filename as a parameter. The function creates an empty file. - An example is shown below: - create_file("myfile.txt") File myfile.txt should now be visible in the working directory 2. read_file - takes filename as a parameter and returns a string with file content. - An example is shown below, for the file myfile.txt assuming it has two separate lines, which are "This is The Pennsylvania " and "State University". 0 read_file("myfile.txt") Dutput: "This is The Pennsylvania State University" 3. read_file_lines This function takes filename as a parameter. and returns a list whose elements are representative of the lines in the file. An example is shown below, for the file myfile.txt assuming it has two separate lines, which are "This is The Pennsylvanio " and "State University". - read_file_lines("ryfile.txt") Dutput: ['This is The Pennsylvania , 'State University n '] 4. write_to_file separate lines, which are "This is The Pennsylvania " and "State University". write_to_file("ryfile.txt", ["University Park", "PA USA"]) File myfile, txt non loaks like the follawing:- myfile.txt x 2 University Park 3 5. append_to_file An example is show below, for the file myfile.txt assuming it has two separate lines, which are "This is The Pennsylvania " and "State University". - append_to_file("myfile.txt", ["University Park", "PA USA"]) File myfile.txt now looks like the following: myfile.txt 1 This is The Pennsylvania 2 State University 3 University Park 4 PA USA 5 Return values must be assigned to variables before used

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!