Check to find and count How many vowels from file This is the program, I have practice today... Input: how are you? I'am fine Output: This file contains 9 times use vowels word. Program: for Python 3... a = open("samplefile.txt") #open file... count = 0 for line in a: #picking up each line by line from file... b = len(line) #calculate each line length then, these length store in another variable... for i in range(b): #picking up each letter from file in line... if(line[i]=='a' or line[i]=='e' or line[i]=='o' or line[i]=='i' or line[i]=='u'): #check each letter is vowel or not... count = count+1 #count how many time use vowels... print("This file contains %s times use vowels word"%(count)) #print vowel counts... a.close() #close file... --------------------------- This program is contains few basic logics... python b...
Posts
Showing posts with the label Count Vowels from File