Index Ai Academy
Glossary · Phase 7 · Software engineering

Enum

Also written: enums

A fixed set of allowed values, such as an order status of pending, paid or shipped.

An enum is the multiple-choice box on that form. It lists the only allowed values for something, like an order's status. Status("paid") turns text into the enum and raises ValueError for anything not on the list. So "payed" gets caught instead of quietly flowing through your system.

Try it now

One small class gives you named fields, a readable print and a default, with no extra code.

Learn it properly

Types and data modeling · Type hints, dataclasses and checking data at the edges of a program. About 35 minutes.

Create a free account See what's in the lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write