title: Python, variable referenced before assignment even though i did assign it
body: <pre><code>#starting values
  Playerlives = 3
  Playerhealth = 100
  Playerdamadge = 10
  Computerlives = 3
  Computerhealth = 100
  Computerdamadge = 10
  
  
  #function for players attack move
  def attackMove():
      Computerhealth = (Computerhealth - Playerdamadge)
      if Computerhealth &lt;= 0:
          Computerlives = (Computerlives - 1)
          Computerhealth = 100
      else:
          print(&quot;you have hit the computer for&quot;
          , Playerdamadge ,&quot;damadge, leaving it on&quot;,Computerhealth ,&quot;health&quot;)
  </code></pre>
  <p>#my error states that Computerhealth hasnt been defined and that its been refereced before assignment,
  #on the line &quot;Computerhealth = (Computerhealth - Playerdamadge)&quot; , the first reference to Computerhealth is recognised as 100 but the second one isnt</p>