# Python Enums ```python from enum import Enum # Define an Enum for different types of factory-made hamsters class HamsterType(Enum): ROBO = 'Roborovski' SYRIAN = 'Syrian' DWARF = 'Dwarf' # Function that takes an Enum member as an argument and checks the type of hamster def check_hamster_type(hamster): if hamster == HamsterType.ROBO: return "This is a Roborovski hamster." elif hamster == HamsterType.SYRIAN: return "This is a Syrian hamster." elif hamster == HamsterType.DWARF: return "This is a Dwarf hamster." else: return "Unknown hamster type." # Example usage of the function result = check_hamster_type(HamsterType.SYRIAN) print(result) # Output will be: This is a Syrian hamster. ``` ```python from enum import Enum # Define an Enum for different types of factory-made hamsters class HamsterType(Enum): ROBO = 'Roborovski' SYRIAN = 'Syrian' DWARF = 'Dwarf' # Function to get the name and value from an Enum member def get_hamster_details(hamster): return f"Name: {hamster.name}, Value: {hamster.value}" # Example usage to get name and value details_robo = get_hamster_details(HamsterType.ROBO) print(details_robo) # Output: Name: ROBO, Value: Roborovski # Iterating through all Enum members for hamster in HamsterType: print(get_hamster_details(hamster)) # Function that takes an Enum member as an argument and checks the type of hamster def check_hamster_type(hamster): if hamster == HamsterType.ROBO: return "This is a Roborovski hamster." elif hamster == HamsterType.SYRIAN: return "This is a Syrian hamster." elif hamster == HamsterType.DWARF: return "This is a Dwarf hamster." else: return "Unknown hamster type." # Example usage of the type check function result = check_hamster_type(HamsterType.SYRIAN) print(result) # Output will be: This is a Syrian hamster. ```