結果 : how to check for invalid input in python