The lines below are the content of the file named \'thunder.txt\'. Well the nigh
ID: 3582869 • Letter: T
Question
The lines below are the content of the file named 'thunder.txt'. Well the nights busting open These two lanes will take us anywhere We got one last chance to make it real To trade in these wings on some wheels After the execution of the following code, what is the content of the file 'thunderOut.txt'? inF = open('thunder.txt', 'r') outF = open('thunderOut.txt', 'w') for line in inF: if 'we' in line.lower(): outF.write(line) inF.close() outF.close()
a. We got one last chance to make it real b. Well the nights busting open We got one last chance to make it real c. Well the nights busting open We got one last chance to make it real To trade in these wings on some wheels d. thunderOut.txt is an empty file e. none of the above
Explanation / Answer
Answer: E (None of the above)
If the python code is as given below:
inF = open('thunder.txt', 'r')
outF = open('thunderOut.txt', 'w')
for line in inF:
if 'we' in line.lower():
outF.write(line)
inF.close()
outF.close()
The outut would be that the file 'thunderOut.txt' file will be created and it;s content will be as given below:
Well the nights busting open These two lanes will take us anywhere We got one last chance to make it real To trade in these wings on some wheels
NOTE: I have given proper indentation and spacing for the code that is given in the question for the python code to execute successfully. Also note that I assumed that the content of 'thunder.txt' file is in a single line.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.