title: How to get a method's variable inside a class?
body: <p>I want to get the <code>result()</code> method's variable that is called <code>word</code>.</p>
  <p>If someone knows how to do it, please help me.</p>
  <pre><code>def result(self,var1,word=&quot;&quot;,mainlista=mainlista):
      try:
          for i in range(int(var1)):
              x = random.choice(mainlista)
              word += x
      except IndexError:
          pass
  </code></pre>