Question: Python CMSC 206 Can you fix this code ASAP, please??? file = input(Enter a file name: ) lines = open(file) cnt = 0 for line

Python CMSC 206

Can you fix this code ASAP, please???

file = input("Enter a file name: ") lines = open(file) cnt = 0 for line in lines: sp = line.split(" ") if sp[0] == "From": print(sp[1]) ++cnt print("There were " + str(cnt) + " lines in the file with From as the first word")

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!