Exit python program when argument is less than 0
- by Sam
I'd like the program to exit if the input number is less than 0, but sys.exit() isn't doing the trick. This is what I have now:
if len( sys.argv ) > 1:
number = sys.argv[1]
if number <= 0:
print "Invalid number! Must be greater than 0"
sys.exit()