enum
` module in Python to represent enumerations. Here's an example code that demonstrates how to use the `enum
` module to define and use enumerations :from enum import Enum
class Color(Enum):
RED = 1
GREEN = 2
BLUE = 3
print(Color.RED)
print(Color.GREEN)
print(Color.BLUE)
Color.RED
Color.GREEN
Color.BLUE
Enum
` class from the `enum
` module. Then, we define an enumeration called `Color
` by creating a class that inherits from `Enum
`.Color
` class, we define three enumeration members: `RED
`, `GREEN
`, and `BLUE
`. Each member is assigned a unique integer value.print()
` function.