Find the number that appears most frequently in the list
test= [1,2,3,4,2,2,3,1,4,4,4] print(max(set(test),key=test.count)) #-> 4
Commonly used libraries in python: 1.requesuts; 2.scrapy; 3. pillow; 4. twisted; 5. numpy; 6. matplotlib; 7. pygama; 8. ipyhton, etc.
The above is the detailed content of How to find the most frequent number in a list in python. For more information, please follow other related articles on the PHP Chinese website!