+ 2
Program to calculate vowel in file
https://sololearn.com/compiler-playground/col4I73zs5YK/?ref=app
4 odpowiedzi
+ 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}')
+ 3
Help me friends
+ 2
Thanks bro
+ 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)