filename = \'mytxt.txt\' with open(filename, \'w\') as file_object: file_object.
ID: 3908503 • Letter: F
Question
filename = 'mytxt.txt'
with open(filename, 'w') as file_object:
file_object.write('This is my fist line. ')
a sentence to the file mytxt.txt will be added.
the file mytxt.txt will have only one sentence.
Syntax Error
--- open('file_name.txt', mode) as file_object:
contents = file_object.read()
read
while
for
with
with open(filepath) as file_object:
for line in file_object:
print(line)
import matplotlib.pyplot as plt
squares = [1,4,9, 16,25]
plt.plot(squares)
plt.scatter(xvalues , yvalues,edgecolor=‘none’, s=10)
plt.scatter(xvalues , yvalues, c =(0.,1,0.5),edgecolor=‘none’, s=10)
3. What is the output of the following code?filename = 'mytxt.txt'
with open(filename, 'w') as file_object:
file_object.write('This is my fist line. ')
(Points : 1)
Explanation / Answer
25 json.dump
24 c =(0.,1,0.5)
23 s=10
22 plt.axis
21 plt.title()
20 fill_between
19 plt.plot(x,y,z)
plt.show()
18 plot.plot(x,y)
17 plt.show()
16 matplotlib
15 True
14 'a'
13 counting characters of the file
12 0
1
11 Class
10 class Class2(Class1)
9 __init__
8. 4
7 ['this', 'is', 'a', 'book']
6 'line1 '
5 with
3 the file mytxt.txt will have only one sentence.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.