Read a text file and display the number of vowels/consonants/uppercase/lowercase letters.

#Read a text file and display the number of

#vowels/consonants/uppercase/lowercase letters.

f=open('vowel.txt', 'r')

l=f.readlines()

vow=con=uc=lc=0

print(l)

for i in l:

    for j in i:

        if j.isupper()==True:

            uc+=1

        elif j.islower()==True:

            lc+=1

        if j in 'aeiouAEIOU':

            vow+=1

        elif j!=' ':

            con+=1

print('No. of vowels:',vow)

print('No. of cosonants:',con)

print('No. of uppercase letters:',uc)

print('No. of lowercase letters:',lc) 





Comments

Popular posts from this blog

Binary file update using Python program