0
My program is working correctly for a test case but when more than one error occurs shown in the image. The following code:
alfabeto = dict()
entradas = input()
i = 0
for i in entradas:
texto = input().strip()
texto = texto.lower()
texto = texto.replace(' ', "")
''' Outra forma de ser feito linha acima
texto = ''.join(texto.plit())
'''
for letra in texto:
if letra not in alfabeto:
alfabeto[letra] = 1
else:
alfabeto[letra] = alfabeto[letra] + 1
maior = 0
for chave, valor in alfabeto.items():
if valor > maior:
maior = valor
resultado = []
for chave, valor in alfabeto.items():
if valor == maior:
resultado.append(chave)
print(''.join(sorted(resultado, reverse=False)))
alfabeto.clear()
input used:
3
Computers account for only 5% of the country's commercial electricity consumption.
Input
frequency letters
I never got around to analyzing the code, but at first I think
for i in entradas
should be, in fact,for i in range(int(entradas))
– Woss
Apart from what Anderson said you can delete the variable
i=0
pq it is not used in any part of that code snippet– Tmilitino