Untitled

 avatar
unknown
plain_text
4 years ago
977 B
6
Indexable
'''
Write a Python function that accepts a string and calculate the number of upper case letters and lower case letters. Go to the editor
Sample String : 'The quick Brow Fox'
Expected Output :
No. of Upper case characters : 3
No. of Lower case Characters : 12
'''
def checker(string):
    
    string = input('Enter any sentence: ').split()
    #print('String = ', string)
    
    upper = 0
    lower = 0
    numerical = 0
    
    for word in string:
        if word[0].isupper():
            #print(word, 'is upper case')
            upper = upper + 1
        elif word[0].islower():
            #print(word, 'is lower case')
            lower = lower + 1
        else:
            #print('error')
            numerical = numerical + 1
    
    print('No. of Upper case characters : ', upper)
    print('No. of Lower case characters : ', lower)
    print('No. of Numericals : ', numerical)


print(checker('My name is Andrio and My age is 100 and Birth date is 35 13 1965'))
Editor is loading...