from enum import Enum class States(Enum): HUNGRY = "Hungry"; TIRED = "Tired" RESTLESS = "Restless"; ERRORSTATE = "Error" def action_a(state : States) -> None: match state: case States.HUNGRY: print('\tFeeling hungry') case States.TIRED: print('\tNeed to sleep') case States.RESTLESS: print('\tMaybe a hike') case _: print("\tError: Unknown State.") def action_b(state: States) -> None: state_dict = { States.HUNGRY: '\tFeeling hungry', States.TIRED: '\tNeed to sleep', States.RESTLESS: '\tMaybe a hike' } try: print(state_dict[state]) except KeyError: print(f"\tError: Unknown State") def main(): for function in (action_a,action_b): print(f'Using function "{function.__name__}":') for state in States: function(state) if __name__ == "__main__": main()