title: I'm very new to programming. Is this acceptable?
body: <p>Is it acceptable to use functions like this?  I am not sure if I am doing it correctly.  Is this the correct way to pass values into an array?</p>
  
  <pre><code>def calculateTuitionIncrease(cost, increase, years):  
      counter = 1  
      costsPerYear = []  
      while counter &lt;= years:  
          cost = (cost)+(cost*increase)  
          costsPerYear.append(cost)   
          counter = counter + 1  
      return costsPerYear
  
  def calculateTotalCost(terms,tuition,creditHours,books,roomAndBoard,scholarships):  
      totalBookCost = (books*terms)  
      totalRoomAndBoard =(roomAndBoard*terms)  
      totalCost = (totalBookCost+tuition+totalRoomAndBoard)-(scholarships)  
      return totalCost
  </code></pre>
  
  <p>Is it okay to use a function to let the user exit the program or is there a better way to do it?</p>
  
  <pre><code>def exitProgram():  
      quitProgram = str(raw_input("Would you like to exit the program (y,n)"))  
      while quitProgram != "y" and quitProgram != "n":  
          quitProgram = str(raw_input("Type 'y' if you would like to exit the program and 'n' if you would like to run it again."))  
      return quitProgram
  
  
  def main():
      endProgram = "n"
      while endProgram == "n":
  
          #Variable declaration/initialization
          years = 0
          terms = 0
          numberOfSchools = 0
  
          tuitionCost1 = 0
          tuitionCost2 = 0
          tuitionCost3 = 0
          tuitionCost = 0
  
          bookCost = 0
          roomAndBoard = 0
          scholarships = 0
  
          tuitionIncrease = 0
          adjustedTuitions = 0
          sumOfTuitionCosts = 0
          averageTuitionCost = 0
          totalTuitionCost = 0
  
          creditHours = 0
          overallCost = 0
  
          #User inputs
          years = int(input("Will you be going to school for 2, 4 or 6 years?"))
  
          while years != 2 and years != 4 and years !=6: #Input validation for years.
              years = int(input("Please try again. Do you plan on going to school for 2, 4 or 6 years?"))
  
          #If-statements for if the user will be attending multiple schools.
          if years == 4 or years == 6:
              numberOfSchools = int(input("How many schools do you plan on attending during this time?"))
  
          if numberOfSchools == 2:
              tuitionCost1 = int(input("How much will you be paying per credit hour at the first school you'll be attending?"))
              tuitionCost2 = int(input("How much will you be paying per credit hour at the second school you'll be attending?"))
              tuitionCost = (tuitionCost1+tuitionCost2)/(2) #Finds average tuition between schools &amp; assigns it to a variable
  
          elif numberOfSchools == 3:
              tuitionCost1 = int(input("How much will you be paying per credit hour at the first school you'll be attending?"))
              tuitionCost2 = int(input("How much will you be paying per credit hour at the second school you'll be attending?"))
              tuitionCost3 = int(input("How much will you be paying per credit hour at the third school you'll be attending?"))
              tuitionCost = (tuitionCost1+tuitionCost2+tuitionCost3)/(3) #Finds average tuition cost between schools &amp; assigns it to a variable
  
          else:
              tuitionCost = int(input("Please enter how much you will be paying per credit hour."))
  
          terms = (years*2)
  
          #User inputs
          tuitionIncrease = float(input("Please enter the projected tuition increase per year in percentage form (ex. if increase is 7% enter .07)."))
          creditHours = int(input("On average, how many credit hours will you be receiving per term?"))
          roomAndBoard = int(input("Please enter what your price of room and board will be per term."))
          bookCost = int(input("Please enter what your average book cost will be per term."))
          scholarships = int(input("Please enter the total amount you will be recieving from grants and scholarships."))
  
          #Calls function that calculates tuition increase per year
          adjustedTuitions = calculateTuitionIncrease(tuitionCost, tuitionIncrease, years)
  
          sumOfTuitionCosts = sum(adjustedTuitions)
          averageTuitionCost = (sumOfTuitionCosts/years) #Average cost of tuition between all schools including the projected tuition increase.
          totalTuitionCost = (averageTuitionCost* creditHours)*(terms) #Calculates total cost of JUST tuition.
  
          #Calls function that calculates the total cost of all expenses.
          overallCost = calculateTotalCost(terms,totalTuitionCost,creditHours,bookCost,roomAndBoard,scholarships)
  
  
          if numberOfSchools ==2 or numberOfSchools ==3:  #Average tuition rate is only displayed if the user is attending more than 1 college.
              print("The average tuition cost per credit hour between the schools you'll be attending, including the projected tuition increase is", round(averageTuitionCost, 2))
  
          print ("The total estimated cost for your tuition alone is",round(totalTuitionCost, 2)) #total cost of TUITION ONLY.
          print ("Your total estimated college cost with all expenses is", round(overallCost, 2)) #cost for ALL expenses.
  
          endProgram = exitProgram()#Calls function that lets user choose to end program
  
  main()
  </code></pre>