def computeTotalNameScores():
	list_of_names = readTextFile()  # read all the names from the text file in to a list.
	list_of_names.sort() # sort all names in the list alphabetically
	sum_of_name_scores = 0
	for name in list_of_names:
		word_value = Common.computeAlphabeticalValue(name) # compute alphabetical value of the name
		sum_of_name_scores = sum_of_name_scores + (list_of_names.index(name)+1)*word_value #Multiply each name's alphabetical value with its position in the list to get its name score.
	return sum_of_name_scores 		
def findTriangleWordCount():
	# read all the words from the text file in to a list.
	list_of_words = readTextFile()

	list_of_triangular_words = [] # will store all the triangular words.

	for word in list_of_words:
		word_value = Common.computeAlphabeticalValue(word) # compute word value.

		# check if the word value is a triangular number
		# The equation word_value = n*(n+1)/2 can be rewritten as n*n + n - 2*word_value = 0
		# Thus, a = 1, b = 1, c = -2*word_value
		if (solveQuadraticEquation(1,1,-2*word_value) > -1):
			list_of_triangular_words.append(word)

	return len(list_of_triangular_words)