Python · Enumerations & Flags

When defining an Enum, what does enum.auto() do, and what value does the first auto member get?

Answer locked. Get the free KnowCard app to reveal it — plus spaced-repetition review so it actually sticks.

Get it on App StoreGet it on Google Play

This is one card from the KnowCard library — thousands more across SAP, Linux, Python and more. In the app you get the answer, AI explanations, and cards that come back right before you would forget them. Free to start on iOS, Android or the web.

More in Enumerations & Flags

You model weekdays as plain ints (Monday = 1, ...). What real problems does this invite that an Enum prevents?
What does this print? ``` import enum class Day(enum.Enum): Mon = 1 print(Day.Mon == 1) ```
Given a plain Enum member, how do you get its display name versus its underlying stored value?
Two variables both hold Color.RED from the same Enum. Should you compare them with is or ==, and why does it matter?
What are the two ways to look up an Enum member from data — one from its stored value, one from its name string?
What does this print? ``` class Day(enum.Enum): Mon = 1 Tue = 2 Holiday = 1 for d in Day: print(d.name) ```

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play