Answers for "what are enumerators in python"

1

enumeration python

from enum import Enum

class Color(Enum):
    RED = 1
    GREEN = 2
    BLUE = 3

print(Color.RED)

class Shake(Enum):
	VANILLA = 7
    CHOCOLATE = 4
    COOKIES = 9
    MINT = 3
Posted by: Guest on January-26-2021
0

what does enumerate do in python

The enumerate() function assigns an index to each item in an 
iterable object that can be used to reference the item later. 
What does enumerate do in Python? It makes it easier to keep 
track of the content of an iterable object.
Posted by: Guest on April-21-2021

Python Answers by Framework

Browse Popular Code Answers by Language