Is there a similar substituite to .exit() and sys.exit() that stops the program from running but without terminating python entirely?
Here's something similar to what I want to achieve:
import random
my_num = random.uniform(0, 1)
if my_num > 0.9:
# stop the code here
# some other huge blocks of codes
Here's why I think I need to find such a command/function:
I want the code to run automatically so definitely not "Ctrl+C"
I don't want python to terminate because I want to check other previously defined variables
I think
elsedoes not work well because there will be a huge amount of other codes after the condition check and there will be other .py to be running byos.system()Of course, force triggering an error message like would do but is that the only way?
time.sleep(...)?input("press y to continue")?