Question: 1: You can read from strings but CANNOT replace, insert or remove from it. This means that strings are Explain this concept. 2: Given name




1: You can read from strings but CANNOT replace, insert or remove from it. This means that strings are Explain this concept. 2: Given name = "Alan Turing". Complete the last two columns for the 3: Given fname = "myfile.txt". Complete the last two columns for the 4. All data output to or input from a text file must be what data type. Explain. 5. Assume an input file named myfile.txt resides in the same folder as your codes. a: Write the syntax to open this file for input. Use the file object name, inputFile. b: Using the variable name, text (string), write the syntax to read the entire contents of this file stored in this variable. c: Print the contents of text variable. d: Provide the codes you will use to open an output file and write the text into this file. 6: There are several methods to read from a file in Python, not just one. Assume that a file object called fobj has already been created. Provide the answers for the following: (a) Reading entire contents or few characters of a file using the file object (fobj), you will use the syntax: (b) Read a single line from the file using the fobj: file in Python, not just one. Assume that a file object called fobj has already been created. Provide the answers for the following: (a) Reading entire contents or few characters of a file using the file object (fobj), you will use the syntax: (b) Read a single line from the file using the fobj: (c) Looping over the file object to read a line at a time, you will use: (d) Read all the lines of a file in a list you can use: or 7: Assume that a file object called fileObj has already been created for writing. How will you put the sentence: 'This is a test' into this file and also make sure it is properly saved
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
