How to exit python console if condition does not satisfies

I want to input an integer as a password from the user and if password does not match, the python console should close.


exit() command can help. Refer the code below:

password = int(input())
your_password = 123
if password!=your_password:   #match the password
    exit()          #exit if password does not match