0

How can I implement enum in python 3.7 version?

27th Apr 2020, 6:42 AM
harini madduri
harini madduri - avatar
5 odpowiedzi
0
from enum import Enum class Color(Enum): red = 1 green = 2 blue = 3 print(Color.red)
27th Apr 2020, 6:52 AM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar
0
from enum import Enum class Color(Enum): red = 1 green = 2 blue = 3 print(Color.red) It shows error like this name 'Color' is not defined
27th Apr 2020, 6:59 AM
harini madduri
harini madduri - avatar
0
Can you execute the following and share the output, to get more info about your Version? import sys print(sys.version) print(sys.version_info)
27th Apr 2020, 7:06 AM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar
0
3.7.4 version Actually I tried all ides of python but I didn't got the output of enum
27th Apr 2020, 7:13 AM
harini madduri
harini madduri - avatar
- 1
color inherited from the Enum class so instantiate it color = Color() print(color.red) If we use this it shows an error like expected an indented block
27th Apr 2020, 12:29 PM
harini madduri
harini madduri - avatar