Q. Write a program to count the number of uppercase alphabets present in a text file "Pome.txt".

 

Answer = 

 

count = 0

file = open("Pome.txt ","r")
sen = file.read()
for i in range ( len(sen) ) :
    if sen[ i ].isupper() :
        count += 1

print("Number of upper case alphabet  : ", count)

file.close()


2 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. def count_upper():
    f=open('pome.txt',r)
    data=x.read()
    count=0
    for c in data():
    if c.isupper():
    count=count+1
    print('total upper case's,data)
    f.close()

    ReplyDelete
  2. This can be easy and helpful

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post