1def is_sorted(data) -> bool:
2 """Determine whether the data is sorted."""
3 return all(data[i] <= data[i + 1] for i in range(len(data) - 1))
4
5def bogo_sort(data) -> list:
6 """Shuffle data until sorted."""
7 count = 0
8 while not is_sorted(data):
9 shuffle(data)
10 temp_str = " "
11 count += 1
12 for i in range(len(data)):
13
14 temp_str = temp_str + " " + str(data[i])
15
16 print(temp_str)
17 print(count)
18 return data
19
20