def findMajorityElement(lst):
 dd = defaultdict(int)
 n = len(lst)
 for i in lst:
  dd[i] += 1
 for key in dd:
  if (dd[key] > (n // 2)):
   return key
 return None

def findMajorityElement ( lst ) : dd = defaultdict ( int ) n = len ( lst ) for i in lst : dd [ i ] += 1 for key in dd : if ( dd [ key ] > ( n // 2 ) ) : return key return None
lst: list of entries to find a majority element from return: majority element "majority element" here refers to an element of a list that occurs the "majority" of the time .