title: Python 3.6 - Writing to a random variable
body: <p>First of all, apologies for the title, I couldn't think of a better one. What I want to do is to be able to reduce the amount of if statements in my code.
  Here is my code:</p>
  
  <pre><code>if var is "forwardThrustButton":
      global forwardThrustButton
      forwardThrustButton = res
  elif var is "backThrustButton":
      global backThrustButton
      backThrustButton = res
  elif var is "leftRotateButton":
      global leftRotateButton
      leftRotateButton = res
  elif var is "rightRotateButton":
      global rightRotateButton
      rightRotateButton = res
  elif var is "basicShootButton":
      global basicShootButton
      basicShootButton = res
  elif var is "specialShootButton":
      global specialShootButton
      specialShootButton = res
  elif var is "bombShootButton":
      global bombShootButton
      bombShootButton = res
  </code></pre>
  
  <p>As you can see I have a lot of if statements here, using a string that I have put into a function, and checking to see what that string is. This code works. What I want to do is to be able to pass the name of a variable into the function and just say <code>var = res</code>. Thanks in advance.</p>