Question: file input and output Coding Problem 4.4.1 (External resource) (3.0 points possible) AngryFileFinder py Submit Run Grades Reset 1 tWrite a function called a 2

file input and output file input and output Coding Problem 4.4.1 (External resource) (3.0 points possible)

Coding Problem 4.4.1 (External resource) (3.0 points possible) AngryFileFinder py Submit Run Grades Reset 1 tWrite a function called a 2 #filename as a parameter. The function should 3#read it, and return True if the file contains "," on every 4#line. Otherwise the function should return False file finder" that accepts a open the file, [Executed at: Sat Apr 14 14:51:50 PDT 2818] 6#Hint: there are lots of ways to do this. We'd suggest using 7#either the readline() or readlines() methods. readline() 8#returns the next line in the file; readlines() returns a 9#list of all the lines in the file We found a few things wrong with your code. The first one is shou n below, and the rest can be foun d in ful1_results.txt in the drop down in the top left: 12 #write your function here! 13 def angry file finder(filename): 14 inputFile open(fi 15 contents-inputFile.readlines() 16 We tested your code with filename "AutomatedTest-rBbkHh.txt. We expected angry_file finder to re turn the bool False. However, it for content in contents: if"not in content: returned the bool True 18 19 return False return True 20 inputFile.close) 21 23#Below are some lines of code that will test your 24 #You can change the value of the variable(s) to test your 25 #function with different inputs 26 # function 27 #If your function works correctly, this will originally 28 #print : True 29 print(engry file_finder"AngryFileFinderInput.txt")) 3e 31 32 34

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!