title: I want workaround for not using global variable in the code
body: <p>Below is my sample and I want a workaround for not using the global variable inside the function.</p>
  
  <pre><code>Legend = '''
  &lt;style&gt;
  table {
      font-family: Times New Roman, sans-serif;
      border-collapse: collapse;
      width: 100%;
  }
  td, th {
      border: 1px solid #000000;
      text-align: center;
      height: 20px;
      overflow: hidden;
      padding: 2px;
  }
  tr:nth-child(even) {
      background-color: #ffffff;
  }
  &lt;/style&gt; '''
  for i in ts:
      Legend+= '&lt;th&gt;' + i + '&lt;/th&gt;'
  Legend += '''&lt;/tr&gt;'''
  
  def get_data_legend(value,name,sym=None):
      global Legend
      L1 = []
      for i in value:
         L1.append('{:,.0f}'.format(i))
      Legend += '''&lt;tr&gt;&lt;th&gt;'''+name+'''&lt;/th&gt;'''
      for i in gt:
          if sym is not None:
               Legend+= '&lt;td&gt;' + sym + str(i)  + '&lt;/td&gt;'
          else:
               Legend += '&lt;td&gt;' + ' ' + str(i)  + '&lt;/td&gt;'
      Legend += '''&lt;/tr&gt;'''
  
  get_data_legend(update_datapoints,'Update metrics')
  get_bus_metrics(update_address,'Update address')
  Legend += '''&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;&lt;br&gt;'''
  </code></pre>
  
  <p>I am using the global variable inside the function that is not good to use or worst thing to use. I am looking for a workaround so that I don 't need to used global variable inside the function. I am new to the python can someone please try to help me on this.</p>