@Chandini , Enum was added to Python 3.4 and more advanced technques can be used using aenum library.To use aenum ,run $ pip install aenum.
Ex-
For new versions,
from enum import Enum
Stationary = Enum('Stationary', 'pen pencil eraser ink')
Stationary.pen #returns <Stationary.pen:1>
Stationary['pen'] #returns<Stationary.pen : 1>
Stationart.pen.name #returns ‘pen’
For earlier versions:
def enum(**enums):
return type('Enum', (), enums)
Example-
>>> Num = enum(ZERO='zero',ONE=1, TWO='two')
>>>Num.ZERO
'zero'
>>> Num.ONE
1
>>> Num.TWO
'two'
If you are looking for upskilling yourself in python you can join our Python Certification and learn from an industry expert.