def input_digit(input_msg, max_retries=4, fail_msg='Invalid input, this channel will be skipped'): """Show the user an input dialogue to enter a digit, return 0 if it failed after max_retries""" num, count = 0, 0 while True: count += 1 try: num = int(input(input_msg + ' ')) break except ValueError: if count < max_retries: print("Your input wasn't a number, please try again:") else: print(fail_msg) break return num