title: Global name 'X' not defined
body: <p>I looked in all kind of similar questions, but just couldn't find one that fitted my situation (or maybe there is one, but I'm new to programming).</p>
  
  <p>The version of Python that I use is 2.7.4, and I get in my program the error on line 11: <code>NameError: global name 'opp' is not defined</code></p>
  
  <p>I wanted to make a calculator for dimensions of floors.
  Here is my code:</p>
  
  <pre><code>def oppervlakte():
      global lengte
      global br
      global opp
  
      lengte = raw_input("Voer de lengte in: ") # Put in the length
      br = raw_input("Voer de breedte in: ") # Put in the width
      opp = lengte * br # Calculates the dimension of the floor
      return int(lengte), int(br) # Makes the variables lengte &amp; br an integer
  
  print opp
  </code></pre>
  
  <p>Since I now got the answer, I want to share it with you, so here it is:</p>
  
  <pre><code>def oppervlakte():
      lengte = raw_input("Voer de lengte in: ") # Asks for the length
      br = raw_input("Voer de breedte in: ") # Asks for the width
  
      lengte = int(lengte) # String lengte --&gt; int lengte 
      br = int(br) # String br --&gt; int br
  
      opp = lengte * br # Calculates the dimensions of the floor
  
      return opp, lengte, br
  
  opp, lengte, br = oppervlakte()
  print "De oppervlakte is", opp # Prints the dimension
  </code></pre>