Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 createfilefilename:
with openfilenamew as file:
file.writenamecolor,type
file.writecarnationpink,annual
file.writedaffodilyellow,perennial
file.writeirisblue,perennial
file.writepoinsettiared,perennial
file.writesunfloweryellow,annual
# Read the file contents and format the information about each row
def contentsoffilefilename:
returnstring
# Call the function to create the file
createfilefilename
# 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
returnstring a is
format
return returnstring
#Call the function
printcontentsoffileflowerscsv
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started