Objective
Create a Python program with an enumeration: a set of named constants.
Instructions
- Import
Enumfromenumand define the classStatewith three members:PENDING = 1,IN_PROGRESS = 2andDONE = 3. - Read an integer, the state code, and look up the member with
State(code). If it does not exist, Python raisesValueError. - If it exists, show
State: NAME (VALUE), using.nameand.value. Otherwise, showUnknown state.
2
State: IN_PROGRESS (2)
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise