1
The code has the idea of only reading how many times the highest array value repeats.
num_velas = int(input('Número de velas: '))
alturaVelas = []
alturaVelas = input('Qual a altura das velas?').strip().split() #altura das velas dada em cm
alturaVelasCrescente = sorted(alturaVelas)
velasRetiraveis = alturaVelasCrescente.count(max(alturaVelas)) #o usuário pode retirar apenas as velas mais altas.
print(str(velasRetiraveis))
When performing a test with 100000(one hundred thousand) entries being ONE entry value 999 and all other entries are 1000. You should register 99999 times the value '1000' and once the value of '999'. You could tell me why I was wrong?
I could not reproduce the error in pycharm because it is a very high number of inputs, the emulator that tested does not return the error.
You have not converted the heights to int, so they remain string; so 999 is greater than 1000, as it will be considered alphabetical order, since 1 comes before 9.
– Woss
Convert the candle height to int().
– Cadu