Can someone help me to stop a script?

hi, i need help for my project
i need it so if a correct input is inputted it doesnt show this script
i basically want it so if correct input is inputted a keyboard interrupt (if incorrect input is inputted) does not show and does not work when correct input is inputted

I’m not sure what you are asking.

To stop a script early do this:

import sys
sys.exit("Script has stopped") # Error message is optional