Article Outline
Python example 'python code sort list 1'
python code sort list 1
Python code example: python code sort list 1
my_list = ["leaf", "cherry", "fish"]
# Brute force method using bubble sort
my_list = ["leaf", "cherry", "fish"]
size = len(my_list)
for i in range(size):
for j in range(size):
if my_list[i] < my_list[j]:
temp = my_list[i]
my_list[i] = my_list[j]
my_list[j] = temp
Useful links
- Learn Python: https://pythonbasics.org
- Download Python: https://python.org
More Python: https://pythonprogramminglanguage.com