All the IPython Notebooks in this example series by Dr. Milan Parmar are available @ GitHub
In this example, you will learn to represent enum.
To understand this example, you should have the knowledge of the following Python programming topics:
# Example 1: Using enum module
from enum import Enum
class Day(Enum):
MONDAY = 1
TUESDAY = 2
WEDNESDAY = 3
# print the enum member
print(Day.MONDAY)
# get the name of the enum member
print(Day.MONDAY.name)
# get the value of the enum member
print(Day.MONDAY.value)
'''
>>Expected output:
Day.MONDAY
MONDAY
1
'''
Day.MONDAY MONDAY 1
'\n>>Expected output:\n \n52.9\n0.0\n'
You can refer to the official documentation of enum for more information.