Skip to content
Advertisement

Fixing code when printing frequent values, python

Related to Counter when 2 values are most frequent

I made a demo list for the example, Running it with “for i in range (len(lines))”:

JavaScript

First round, there is only one occurred value “1”, but in the second round there are 3: 41,23,67. That’s why I did a for loop and matched “most” to “a” but del_connected prints the wrong values and so the “lines” list itself –>

JavaScript

How do I fix it’s print when there are more than one frequent value?

Advertisement

Answer

Do you want something like this:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement