0
I have a string any and I need to know the amount of upper and lower case letters in that string. I started sketching something like this:
def contaMaiuscula(string):
ma = 0
mi = 0
for c in string:
if(c == ????):
ma = ma+1
else:
mi = min +1
return ma, mi
But how do I know if a character is uppercase or lowercase? Is there a function for this?
Ana, you tried to use the method
isalpha()
? Python - The basics about string– Luiz Augusto
No, I tried islower(), but it didn’t work :(
– Ana Carolina Esteves