import statistics


def get_password_lengths(creds: list):
	"""
	Determine how many passwords have what lengths
	"""
	lengths = {}
	s = 0
	for p in creds:
		if len(p) not in lengths.keys():
			lengths[len(p)] = 1
		else:
			lengths[len(p)] += 1
		s += len(p)
	
	# The reason I didn't make this an orderdict or use Collections.Counter is I wanted a direct way to
	# find the average and median lengths
	data = {"average_length": s/len(creds), "median_length": statistics.median([len(x) for x in creds]), "lengths":lengths}
	return data