#Bubbleing around

Since everybody hates chaos and loves sorted lists we should implement some more sorting algorithms. Your task is to implement a Bubble sort (for some help look at https://en.wikipedia.org/wiki/Bubble_sort) and return a list of snapshots after **each change** of the initial list.

e.g. 

If the initial list would be l=[1,2,4,3] my algorithm rotates l[2] and l[3] and after that it adds [1,2,3,4] to the result, which is a list of snapshots.
```
[1,2,4,3] should return [ [1,2,3,4] ]
[2,1,4,3] should return [ [1,2,4,3], [1,2,3,4] ]
[1,2,3,4] should return []
```

Difficulty: EASY
Starter code: def bubble(l):
	

Solutions:
def bubble(l):
	ret = []
	for i in range(len(l) - 1, 0, -1):
		for j in range(i):
			if l[j] > l[j + 1]:
				(l[j], l[j + 1]) = (l[j + 1], l[j])
				ret.append(l[:])
	return ret


def bubble(l):
	(bubbling, bubbles) = (True, [])
	while bubbling:
		bubbling = False
		for i in range(len(l) - 1):
			if l[i] > l[i + 1]:
				(l[i], l[i + 1]) = (l[i + 1], l[i])
				bubbling = True
				bubbles.append(l[:])
	return bubbles


def bubble(l):
	arr = []
	for j in range(len(l) - 1, 0, -1):
		for i in range(j):
			if l[i] > l[i + 1]:
				temp = l[i]
				l[i] = l[i + 1]
				l[i + 1] = temp
				arr.append(l[:])
	return arr


def bubble(lst):
	result = []
	mod = lst.copy()
	swap = True
	while swap:
		swap = False
		for i in range(len(mod) - 1):
			if mod[i] > mod[i + 1]:
				(mod[i], mod[i + 1]) = (mod[i + 1], mod[i])
				swap = True
				result.append(mod.copy())
	return result


def bubble(l):
	snapshots = []
	for i in range(len(l), 1, -1):
		for j in range(1, i):
			if l[j - 1] > l[j]:
				(l[j - 1], l[j]) = (l[j], l[j - 1])
				snapshots.append(l[:])
	return snapshots


def swap(l, aindex, bindex):
	tmp = l[bindex]
	l[bindex] = l[aindex]
	l[aindex] = tmp

def bubble(l):
	result = []
	for _ in range(len(l) - 1):
		for i in range(len(l) - 1):
			if l[i] > l[i + 1]:
				swap(l, i, i + 1)
				result.append(list(l))
	return result


def bubble(l):
	(n, permutations) = (len(l), [])
	while n:
		m = 0
		for i in range(1, n):
			if l[i - 1] > l[i]:
				(l[i - 1], l[i]) = (l[i], l[i - 1])
				permutations.append(l[:])
				m = i
		n = m
	return permutations


def bubble(l):
	(output, toChange) = ([], True)
	while toChange:
		toChange = False
		for (i, x) in enumerate(l[:-1]):
			if l[i + 1] < l[i]:
				(l[i], l[i + 1]) = (l[i + 1], l[i])
				output.append(l[:])
				toChange = True
	return output


def bubble(l):
	r = []
	for i in range(0, len(l)):
		for j in range(1, len(l)):
			if l[j] < l[j - 1]:
				t = l[j]
				l[j] = l[j - 1]
				l[j - 1] = t
				r.append(l[:])
	return r


def bubble(a):
	if a == None or len(a) < 2:
		return []
	swapped = True
	i = 0
	r = []
	while i < len(a) - 1 and swapped:
		swapped = False
		for j in range(len(a) - i - 1):
			if a[j] > a[j + 1]:
				(a[j], a[j + 1]) = (a[j + 1], a[j])
				r.append(list(a))
				swapped = True
		i += 1
	return r