Question: import os import csv # Create a file with data in it def create _ file ( filename ) : with open ( filename ,

import os
import csv
# Create a file with data in it
def create_file(filename):
with open(filename,"w") as file:
file.write("name,color,type
")
file.write("carnation,pink,annual
")
file.write("daffodil,yellow,perennial
")
file.write("iris,blue,perennial
")
file.write("poinsettia,red,perennial
")
file.write("sunflower,yellow,annual
")
# Read the file contents and format the information about each row
def contents_of_file(filename):
return_string =""
# Call the function to create the file
create_file(filename)
# Open the file
___
# Read the rows of the file
rows =___
# Process each row
for row in rows:
___= row
# Format the return string for data rows only
return_string +="a {}{} is {}
".format(___)
return return_string
#Call the function
print(contents_of_file("flowers.csv"))

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!