Command to end the program

1

There is a command to terminate the program in Python or you can just end it by using ways like this:

print()
    
asked by anonymous 21.11.2017 / 17:27

1 answer

3

In general, the end of the code ends the execution, of course if it is in a function called only the function will be finished and will return to the called.

It is recommended to leave the explicit intention other than in very trivial codes, so putting a final 'return' would be a good idea.

If you want to stop immediately at any point you can use sys.exit() . Do not forget to import the import sys module.

    
21.11.2017 / 17:35