Program to calculate vowel in file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
9th Dec 2023, 5:50 PM
RAJ SONI😈😈
RAJ SONI😈😈 - avatar
4 Answers
+ 8
v =['a','e','i','o','u'] f = open("example.txt","w") str = "raj soni is a good boy\nand he loves coding" f.write(str) f.close() f = open("example.txt","r") lines = f.readlines() nr = 0 for line in lines: count1 = 0 count2 = 0 nr +=1 for i in line: if i in v: count1 = count1 + 1 else: count2 += 1 print(f"trhe no. of vowel in line {nr} is => {count1}") print(f'trhe no. of other in line {nr} is => {count2}')
9th Dec 2023, 6:37 PM
JaScript
JaScript - avatar
+ 3
Help me friends
9th Dec 2023, 5:50 PM
RAJ SONI😈😈
RAJ SONI😈😈 - avatar
+ 2
Thanks bro
9th Dec 2023, 6:44 PM
RAJ SONI😈😈
RAJ SONI😈😈 - avatar
+ 2
v = 'aeiou' with open("example.txt","w") as f: str = "raj soni is a good boy and he loves coding" f.write(str) with open("example.txt","r") as f: lines = f.readlines() for line in lines: count = 0 for i in line: if i in v : count += 1 print("ndjseh") print("The no. of vowel in file is => ",count)
10th Dec 2023, 4:37 AM
Bob_Li
Bob_Li - avatar