title: Python program gives me range of items instead of most/least frequent item
body: <p>I've created a GUI using wxFormBuilder that should allow a user to enter the names of "visitors to a business" into a list and then click one of two buttons to return the most frequent and least frequent visitors to the business. Unfortunately, when I click the button, it gives me the range of visitors, rather than the name of the most/least frequent visitor. I've attached a screenshot of the GUI I've created to help add a little clarity to the issue and have appended my code. Thanks in advance for your help with this.</p>
  
  <p><img src="https://i.stack.imgur.com/tzJXl.png" alt="enter image description here"></p>
  
  <p>Code:</p>
  
  <pre><code>import wx
  import myLoopGUI
  
  class MyLoopFrame(myLoopGUI.MyFrame1):
      def __init__(self, parent):
          myLoopGUI.MyFrame1.__init__(self, parent)
  
      def clkAddData(self,parent):
          if len(self.txtAddData.Value) != 0:
              try:
                  myname = str(self.txtAddData.Value)
                  self.listMyData.Append(str(myname))
              except:
                  wx.MessageBox("This has to be a name!")            
          else:
              wx.MessageBox("This can't be empty")
  
  
  
  
      def clkFindMost(self, parent):
          word_amount = range(self.listMyData.GetCount())
          numberofitems = self.listMyData.GetCount()
          unique_words = []
          for word in word_amount:
                  if word not in unique_words:
                      unique_words += [word]
          word_frequencies = []
          for word in unique_words:
              word_frequencies += [float(word_amount.count(word))/len(word_amount)]
  
          max_index = 0
          frequent_words =[]
          for i in range(len(unique_words)):
              if word_frequencies[i] &gt;= word_frequencies[max_index]:
                  max_index = i
                  frequent_words += [unique_words[max_index]]
          self.txtResults.Value = str(frequent_words)
  
  
  
  myApp = wx.App(False)
  myFrame = MyLoopFrame(None)
  myFrame.Show()
  myApp.MainLoop()
  </code></pre>
  
  <p>@Yep_It's_Me was kind enough to chime in and offer another way forward:</p>
  
  <pre><code>import wx
  import myLoopGUI
  import commands
  
  class MyLoopFrame(myLoopGUI.MyFrame1):
      def __init__(self, parent):
          myLoopGUI.MyFrame1.__init__(self, parent)
  
      def clkAddData(self,parent):
          if len(self.txtAddData.Value) != 0:
              try:
                  myname = str(self.txtAddData.Value)
                  self.listMyData.Append(str(myname))
              except:
                  wx.MessageBox("This has to be a name!")            
          else:
              wx.MessageBox("This can't be empty")
  
  
  
  
      def clkFindMost(self, parent):
          self.listMyData = []
          unique_names = set(self.listMyData)
          frequencies = {}
          for name in unique_names:
              if frequencies.get[name]:
                  frequencies[name] += 1
              else:
                  frequencies[name] = 0
  
          v = list(frequencies.values())
          k = list(frequencies.keys())
          self.txtResults.Value = k.index(max(v))
  
  
      def clkFindLeast(self, parent):
          unique_names = set(self.listMyData)
          frequencies = {}
          for name in unique_names:
              if frequencies.get(name):
                  frequencies[name] += 1
              else:
                  frequencies[name] = 0
  
          v = list(frequencies.values())
          k = list(frequencies.keys())
          self.txtResults.Value = k.index(min(v))
  
  myApp = wx.App(False)
  myFrame = MyLoopFrame(None)
  myFrame.Show()
  myApp.MainLoop()
  </code></pre>
  
  <p>But now I'm receiving a Value error:</p>
  
  <p><strong>ValueError: max() arg is an empty sequence</strong> </p>
  
  <p>In relation to this line:</p>
  
  <pre><code>**self.txtResults.Value = k.index(max(v))**
  </code></pre>
  
  <p>Never mind! @Yep_It's_Me offered a fantastic solution. Thank you so much.</p>