import random

my_list = [1, 5, 92, 231, 3, 0, -4, 17]

def random_list(length):
    l = [random.randint(-50, 9999) for i in range(length)]
    return l

def bubble_sort(target_list):
    for sorted_count in range(len(target_list)):
        swapped = False
        for i in range(len(target_list) - sorted_count - 1):
            if target_list[i] > target_list[i + 1]:
                target_list[i], target_list[i + 1] = target_list[i + 1], target_list[i]
                swapped = True
        if not swapped:
            break
    return target_list

print(bubble_sort(my_list))
