For starters, it looks like calculateTuitionIncrease
should be returning a list, because currently it's returning a single value and the loop is wrong (it's not advancing at all):
def calculateTuitionIncrease(cost, increase, years):
# This function calculates the projected tuition increase for each year.
counter = 0
answer = []
while counter <= years:
increasedCost = (cost)+(cost*increase)
answer.append(increasedCost)
counter += 1
return answer
As for the second part of the question, it's not clear how you're supposed to "use that array when calculating the total cost", but surely you must iterate over the list returned by calculateTuitionIncrease
and do something with each element, for each year - you should know how to do this, it must be part of the problem description you received.