Here in the file Samer_DocumentCode.py, there is a bubble sort function defined. The problem here is that the code is hard to understand entirely how it works. The variable names are short and don't make it certain how the values are sorted.
This code overall lacks proper documentation to explain what is happening. This can be difficult for a team to understand if they can't figure out what someone has coded.
# Python program for implementation of Bubble Sort
def bubbleSort(arr):
n = len(arr)
swapped = False
for i in range(n-1):
for j in range(0, n-i-1):
if arr[j] > arr[j + 1]:
swapped = True
arr[j], arr[j + 1] = arr[j + 1], arr[j]
if not swapped:
return
# Driver code to test above
arr = [64, 34, 25, 12, 22, 11, 90]
bubbleSort(arr)
print("Sorted array is:")
for i in range(len(arr)):
print("% d" % arr[i], end=" ")
Here in the file Samer_DocumentCode.py, there is a bubble sort function defined. The problem here is that the code is hard to understand entirely how it works. The variable names are short and don't make it certain how the values are sorted.
This code overall lacks proper documentation to explain what is happening. This can be difficult for a team to understand if they can't figure out what someone has coded.