Parth Patel of class 12 is writing a program to create a CSV file “emp.csv”
which will contain employee code and name of some employees. He has
written the following code. As a programmer, help him to successfully
execute the given task.
import ________#Line 1
def addemp(empcode,name):#to write/add data into the CSV file
fo=open('emp.csv','a')
writer=csv.________ (fo) #Line 2
writer.writerow([empcode,name])
fo.close()
#csv file reading code
def reademp():
with open('emp.csv','_______ ') as fin: #Line 3
filereader=csv.reader(fin)
for row in filereader:
for data in row:
print(data,end='\t')
print(end='\n')
fin._______ #Line 4
addemp('E105','Parth')
addemp("E101",'Arunima')
addemp("E102",'Prahalad')
reademp() #Line 5
Answer the following questions: (1 mark each)
(a) Name the module he should import in Line 1.
(b) Fill in the blank in Line 2 to write the data in a CSV file.
(c) In which mode, Parth should open the file to read the data from the
file(Line 3).
(d) Fill in the blank in Line 4 to close the file.
(e) Write the output he will obtain while executing Line 5. no in
Answers
Answered by
0
Answer:
I don't know sorrry because line 4 is quadrant to line c and b is a formality of all the eqation of the matrics
Similar questions