Capital letter counter X74015


Statement
 

pdf   zip

Write a function @cap_let_counter(s)@ that returns the number of capital letters in string ss. You can use the string method @isupper()@ to check whether given an string it has at least one letter and all its letters are capital letters. For instance, @my_string.isupper()@ is True when @my_string@ is ’HELLO’ or ’1X2’ or ’G’ and is False when @my_string@ is ’He7TO’ or ’x’ or ’123456’.

Sample session

Sample session
>>> cap_let_counter('Game Over')
2
>>> cap_let_counter('Add: 3 + 5')
1
>>> cap_let_counter('000MONTsERRAT000')
9
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python