import time


def bubbleSort(intList):
	"""
	this function takes a list of integers as input and returns a tuple
	where the first element of the tuple is the list sorted from least to
	greatest, and the second element of the list is the runtime from start
	to end in seconds.

	>>> myList = [3,2,1]
	>>> bubbleSort(myList)[0]
	[1, 2, 3]
	"""
	startTime = time.time()
	isSorted = False
	sortedList = intList
	while isSorted == False:
		swap = False # if we go through the whole list with no swaps,
					 # then the list is sorted.
		for i in range(0, len(sortedList)-1):
			if sortedList[i] > sortedList[i+1]:
				swap = True
				temp = sortedList[i]
				sortedList[i] = sortedList[i+1]
				sortedList[i+1] = temp # now sortedList[i] < sortedList[i+1]
			else:
				continue
		if swap == False:
			isSorted = True
	endTime = time.time()
	runtime = endTime - startTime
	return (sortedList, runtime)