else:
    # a=4, b=2, c=4
    print("The roots are complex")
    sys.exit(1)


Normally the Python script exits (returns control to the shell) after the last statement. However, if you want it to exit earlier, you can use the sys.exit() command: The number 1 in exit(1) provides a signal that can be checked in the shell to tell whether the code exited normally. This is a convention that you choose. To get access to the sys.exit() command, import sys at the top of your code.