# checks for an integer more than 0 (allows ) def int_check(question, valid_ans): while True: # Get user response and make sure it's lowercase user_response = input(question).lower() for item in valid_ans: # check if the user response is a word in the list if item == user_response: return item # check if the user response is the same as # the first letter of an itm in the list elif user_response == item[0]: return item return "invalid" # Automatated testing is below in the form (test_case, expected_value) to_test = [ ('xlii', 'invalid'), ('0.5', 'invalid'), ('0', 'invalid'), (1, 1), (2, 2), ('', "infinite"), ] # run test! for item in to_test: # retreive test case and expected value case = item[0] expected = item[1]