vowels in the file
Vowels in the File:
Find the number of vowels in the file and add the count on the file .
Program:
f=open('a.txt','r') #a.txt (filename)
total=0
for line in f.read():
if(line=='a' or line=='e' or line=='i' or line=='o' or line=='u' or line=='A' or line=='E' or line=='I' or line=='O' or line=='U'):
total+=1
f=open('a.txt','a')
f.write('Number of vowels in the file :'+str(total))
f.close
Find the number of vowels in the file and add the count on the file .
Program:
f=open('a.txt','r') #a.txt (filename)
total=0
for line in f.read():
if(line=='a' or line=='e' or line=='i' or line=='o' or line=='u' or line=='A' or line=='E' or line=='I' or line=='O' or line=='U'):
total+=1
f=open('a.txt','a')
f.write('Number of vowels in the file :'+str(total))
f.close
Comments
Post a Comment