Program to count the number of capital letters in a file?

Last updated 3 years, 2 months ago | 1436 views 75     5

Tags:- Python

Python program to count the number of capital letters in a file.

with open(FILE_NAME) as my_file:
    count = 0
    text = my_file.read()
    for character in text:
        if character.isupper():
        count += 1
    print(count)