title: TypeError: unsupported operand type(s) for -: 'function' and 'function'
body: <p>I just started programming in python and i made this little program which sums the total price of n things you've bought.
  Then it sums the total price of n things you've sold and returns what you
  earned. So it seems i made some confusion with functions, but i can't find the mistake, could someone help me? (sorry for my english)
  This is the output:</p>
  
  <pre><code>Type 'earn' to see if you earned something
  Type 'quit' to exit
  Type here: earn
  BOUGHT
  Things you've bought: 3
  SOLD
  Things you've sold: 3
  EARN
  Traceback (most recent call last):
  File "/Users/daze/Documents/earn.py", line 52, in &lt;module&gt;
  main()
  File "/Users/daze/Documents/earn.py", line 11, in main
  earn()
  File "/Users/daze/Documents/earn.py", line 50, in earn
  return sell_sum - buy_sum
  TypeError: unsupported operand type(s) for -: 'function' and 'function'
  </code></pre>
  
  <p>and this is the complete code:</p>
  
  <pre><code>def main():
  print("Type 'earn' to see if you earned something")
  print("Type 'quit' to exit")
  choice_menu = input("Type here: ")
  if choice_menu == 'earn':
      print("BOUGHT")
      buy_sum()
      print("SOLD")
      sell_sum()
      print("EARN")
      earn()
      yes_or_no()
  elif choice_menu == 'quit':
      print("Quitting..")
  else:
      print("Wrong key!")
      main()
  def yes_or_no():
      choice_continue = None
      while choice_continue != 'y' or choice_continue != 'n':
          choice_continue = input("Do you want to continue?(y/n)")
          print("Insert a valid key!")
      if choice_continue == 'y':
          main()
      else:
          print("Quitting..")
  def buy_sum():
      n_buy = eval(input("Things you've bought: "))
      buy_sum = 0
      cont = 1
      price_buy = 0
      while cont &lt;= n_buy and price_buy &lt; 0:
          price_buy = eval(input("Price ", str(cont), ": "))
          buy_sum = buy_sum + price_buy
          print("Actual shipment:", buy_sum)
          cont = cont + 1
      return buy_sum
  def sell_sum():
      n_sell = eval(input("Things you've sold: "))
      sell_sum = 0
      cont = 1
      price_sell = 0
      while cont &lt;= n_sell and price_sell &lt; 0:
          price_sell = eval(input("Price ", str(cont), ": "))
          sell_sum = sell_sum + price_sell
          print("Actual sold:", buy_sum)
          cont = cont + 1
      return sell_sum
  def earn():
      return sell_sum - buy_sum
  
  main()
  </code></pre>
  
  <p>Just tell me why it gives me that error and where i made a mistake, if there are error in whiles or other things like don't correct me, just make me notice that.
  thank you.</p>