def num_check(question, num_type="float"): """checks that response is an integer more than 0""" if num_type == "float": error = "Please enter a number more than 0." else: error = "Please enter an integer more than 0." while True: try: if num_type == "float": response = float(input(question)) else: response = int(input(question)) if response > 0: return response else: print(error) except ValueError: print(error) def not_blank(question): """checks that user response isn't blank""" while True: response = input(question) if response != "": return response print("Sorry, this can't be blank. Please try again\n") # main routine # loop for testing while True: product_name = not_blank("Product name: ") quantity_made = num_check("Number being made: ", "integer") print(f"You are making {quantity_made} of {product_name}") print()