Because you're using upper()
instead of isupper()
upper()
converts to uppercase, it is not a data check.
isupper()
checks whether something is capitalized or not.
Update: The efficient way to do that is not to compare the letter to something else, but to check if the letter is simply upper case.
def eva_cadena():
contador = 0
cadena = input("ingrese una cadena: ")
for i in cadena:
if i.isupper(): # No hace falta convertir nada.
contador += 1
print(contador)
Update 2: In case it is easier to understand without using a function, this would be similar to:
print(sum([i.isupper() for i in input("ingrese una cadena: ")]))