I import two different functions in a separate file but getting Unexpected output.
bubbleSort.py
def checkInputs(n, array):
if n == len(array) and len(array) > 1:
for i in range(0, len(array)):
array[i] = int(array[i])
removeDups = list(set(array))
sortArray = bubbleSort(removeDups)
print(sortArray[len(sortArray) - 2])
else:
print("please enter correct values")
def bubbleSort(unSortArray):
for i in range(len(unSortArray)):
swap = False
for j in range(0, len(unSortArray) - i - 1):
if unSortArray[j] > unSortArray[j + 1]:
swap = unSortArray[j]
unSortArray[j] = unSortArray[j + 1]
unSortArray[j + 1] = swap
swap = True
if swap == False:
break
return unSortArray
test.py
from bubbleSort import checkInputs, bubbleSort
print(checkInputs(5, [1, 2]))
As you can see in screenshot None in the second line output screenshot, why?