title: Local variable referenced before assignment python 3.4.1
body: <p>I am trying to write a program that calculates the cost of a paint job in a room with no windows or doors. I have tried to do this numerous ways. I even tried to follow a similar example I found, but I am at a loss at this point. I keep running into numerous errors. I initially wanted 5 user inputs and that didn't work, so I tried two and still cannot get a proper run. Any help would be great!</p>
  
  <pre><code># This program will calculate how much money
  # it will cost to paint the walls of a shed
  # that is rectangular in shape.
  # Ask user to enter the length of each wall.
  # Ask the user to enter the height of the walls.
  # Calculate the square feet.
  # Divide square feet by 300 (1) gallon.
  
  import math
  
  def main():
  
  
      length = float(input('Enter the length of wall 1: '))
      #L2 = float(input('Enter the length of wall 2: '))
      #L3 = float(input('Enter the length of wall 3: '))
      #L4 = float(input('Enter the length of wall 4: '))
      height = float(input('Enter the height of the walls: '))
      print('ft:', format(ft, '.2f'))
  
      #print('The cost of the paint is $', format(cost, '.2f'))
      ft, sq_ft, gal, cost = paint_cost(length, height)
  
  
  def paint_cost(length, height):
      ft = length * height
      sq_ft = ft * height
      gal = sq_ft / 300
      cost = gal * 40
      return ft, sq_ft, gal, cost
  
  
  # the 40 is the cost of one gallon of paint.
  
  main()
  
  
  Enter the length of wall 1: 5
  Enter the height of the walls: 5
  Traceback (most recent call last):
    File "E:\paint.py", line 38, in &lt;module&gt;
      main()
    File "E:\paint.py", line 21, in main
      print('ft:', format(ft, '.2f'))
  UnboundLocalError: local variable 'ft' referenced before assignment
  </code></pre>
  
  <p>This is the message I am receiving now the way it is.</p>