Find the most frequent number in the list in Python

test  =  [ 1 , 2 , 3 , 4 , 2 , 2 , 3 , 1 , 4 , 4 , 4 ]
print ( max ( set ( test ), key = test . count ))

# -> 4

Post a Comment

Featured Post

Updated Coupons / promo codes for Google Apps for Work / Business

To redeem: 1. Sign up for Google Apps   2. Go to your billing settings  3. Choose your payment plan  4. Enter your promo code ...