# functions go here def num_check(question, num_type="float", exit_code=None): """Checks that response is a float / integer more than zero""" if num_type == "float": error = "Please enter a number more than 0." else: error = "Please enter an integer more than 0." while True: response = input(question) # check for exit code and return it if entered if response == exit_code: return response # check datatype is correct and that number # is more than zero try: if num_type == "float": response = float(response) else: response = int(response) if response > 0: return response else: print(error) except ValueError: print(error) # loop for testing purposes # gets employee hours and wages hours = num_check("Hours per week:", "integer") wages = num_check("Wage per hour: ", "float") # calculates cost per week and tells user cost_per_week = wages * hours print(f"Your employee costs ${cost_per_week} per week.")