Conforme documentação do Python a função seria [`isupper()`][1]. Então seria isto: def contaMaiuscula(string): ma = 0 mi = 0 for c in string: if c.isupper(): ma = ma+1 else: mi = min +1 return ma, mi [1]: https://docs.python.org/3/library/stdtypes.html#str.isupper