Skip to main content
deleted 1 character in body
Source Link
SKN
  • 508
  • 4
  • 11

Assuming wlist is a flat list of words, the is_unique() function could be written as follows:

def is_unique(word, wlist): return wlist.count(word) == 1 

I would write the find_max() function like so:

def find_max(conversations_stats): ind_max = conversations_stats.index(conversations_stats[-1]) maxs = max(conversations_stats)   return ind_max, maxs 

Assuming wlist is a flat list of words, the is_unique() function could be written as follows:

def is_unique(word, wlist): return wlist.count(word) == 1 

I would write the find_max() function like so:

def find_max(conversations_stats): ind_max = conversations_stats.index(conversations_stats[-1]) maxs = max(conversations_stats)   return ind_max, maxs 

Assuming wlist is a flat list of words, the is_unique() function could be written as follows:

def is_unique(word, wlist): return wlist.count(word) == 1 

I would write the find_max() function like so:

def find_max(conversations_stats): ind_max = conversations_stats.index(conversations_stats[-1]) maxs = max(conversations_stats) return ind_max, maxs 
Source Link
SKN
  • 508
  • 4
  • 11

Assuming wlist is a flat list of words, the is_unique() function could be written as follows:

def is_unique(word, wlist): return wlist.count(word) == 1 

I would write the find_max() function like so:

def find_max(conversations_stats): ind_max = conversations_stats.index(conversations_stats[-1]) maxs = max(conversations_stats) return ind_max, maxs