def attribute_ocurrences(records, attribute_name):
	"""
	Finds the values of an attribute and their respective frequencies.

	Returns the values and their respective frequencies.

	Input:
		records - records used to determine values and frequencies;
		attribute_name - name of the attribute whose values and frequencies
	will be determined.
	"""

	frequencies = []	# frequencies of each value
	values = []	# values for this attribute

	for record in records:	# each record
		try:
			i = values.index( record[attribute_name] )
			# find position of this attribute's value in this record

		except ValueError:	# value not accounted for yet
			values.append( record[attribute_name] )	# add it to values
			frequencies.append(1)	# mark its frequency as 1

		else:
			frequencies[i] += 1	# update the value's frequency

	return values, frequencies