def check_parity(args: list[str]): if len(args) == 0: return if len(args) > 1: print("AssertionError: more than one argument is provided") return arg = args[0] # https://docs.python.org/3.10/tutorial/errors.html try: number = int(arg) except ValueError: print("AssertionError: argument is not an integer") return if number % 2 == 0: print("I'm Even.") else: print("I'm Odd.") # execute module as a script : https://docs.python.org/3.10/tutorial/modules.html#executing-modules-as-scripts if __name__ == "__main__": # https://docs.python.org/3.10/library/sys.html import sys check_parity(sys.argv[1:])