Index Ai Academy
Glossary · Phase 0 · Tools

Comprehension

Also written: comprehensions, list comprehension

A one-line way to build a list from another, like [x * 2 for x in prices].

Try it now

The loop builds active one item at a time, checking each one. Line 7 does the same filtering in a single step.

Learn it properly

Comprehensions · Filter and transform a whole collection in one readable line. About 25 minutes.

Start this free 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