Bubble Sorting Python3

import signal
import sys

def sort(input):
    total = 0
    isSorted = False
    ran = len(input) - 1
    while not isSorted:
        isSorted = True
        for j in range(0,ran):
            print(isSorted)
            total +=1
            if input[j] > input[j+1]:
                isSorted = False
                tmp = input[j]
                input[j] = input[j+1]
                input[j+1] = tmp
        ran -= 1
    print(input)
    print(total)

def signal_handler(signal, frame):
        print('You pressed Ctrl+C!')
        sys.exit(0)

def main():
    signal.signal(signal.SIGINT, signal_handler)
    print('Press Ctrl+C to stop, input the array split with space')
    for line in sys.stdin:
        print(line)
        arr = [int(elem) for elem in line.split()]
        sort(arr)

if __name__ == "__main__": main()