0
I have the following code:
def repetido(numeros, count):
for i in range(len(numeros)):
count.append(float(numeros[i]))
for x in range(len(count)):
aux = count.count(count[x])
if aux > count:
repet = count[x]
contador = count.count(repet)
print("Valor que mais ocorreu:",repet,"que foi encontrado:",contador,'vezes(es)')
#Programa Principal
entrada = input().split()
n = []
if len(entrada) == 0:
print('nenhum número foi lido!!!')
else:
print(repetido(entrada, n))
When running the program and give enter, without entering any number, the correct message is displayed.
When I type, for example 1 2 3 2 2 2 2 3, it gives error and does not display what it should display.
I wish I knew where I was wrong.
Thank you!
if aux > count
, you are comparing an integer number with a list. What was the purpose of this line?– Woss