Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help solving some issues in this function that displays only this *There ar

ID: 3533360 • Letter: N

Question

Need help solving some issues in this function that displays only this *There are %d four letter words in the file 0 the words are:* Does not pick-up the ' words.text' file and displays it. Any help if can. Thanks. Additional, is there any site that I can look at and learn on my own besides class.

words = 'words.csv'

def problem5(words):

file = open(words,'r')

line = file.readline()

reader = Csv.reader(words)

ans = 0

w = []

for i in file.readline():

words = i.split(',')

for j in words:

if len(j) == 4:

ans += 1

w = w + [j]

print ("There are %d four letter words in the file ",ans)

print ("the words are: ")

problem5(words)

Explanation / Answer

#make sure the filename is words.csv and located in the same folder as your program

#or post the file words.csv to better understand your code

words = 'words.csv'

def problem5(words):

file = open(words,'r')

line = file.readline()

reader = Csv.reader(words)

ans = 0

w = []

for i in file.readline():

words = i.split(',')

for j in words:

if len(j) == 4:

ans = ans + 1

w = w + [j]

print ("There are " + str(ans) +" four letter words in the file ")

print ("the words are: ")

for i in w:

print(i)

problem5(words)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote