Answered step by step
Verified Expert Solution
Question
1 Approved Answer
fh=open(python.txt,r) count=0 a=fh.readlines() if (a.tolower().count(an) > 0): print(a) fh.close() fname = python.txt num_words = 0 f= open(fname, 'r') words = f.read().split() o for a in
fh=open("python.txt","r") count=0 a=fh.readlines() if (a.tolower().count("an") > 0): print(a) fh.close() fname = "python.txt" num_words = 0 f= open(fname, 'r') words = f.read().split() o for a in words: if (a.tolower() == "a" or a.tolower() == "an"): num_words = num_words + 1 print("Number of words:", num_words) f.close() fh=open("python.txt","r") count=0 lines=fh.readlines() o for a in lines: if (a.tolower().count("an") > 0): print(a) fh.close() fname = "python.txt" num_words = 0 f= read(fname, 'r') words = f.read().split() for a in words: if (a.tolower() == "a" or a.tolower() num_words = num_words + 1 print("Number of words:", num_words) f.close() "an")
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