> For the complete documentation index, see [llms.txt](https://rcc-1.gitbook.io/roblox-py/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rcc-1.gitbook.io/roblox-py/language/comprehension.md).

# Comprehension

```python
myNums = [1, 90, 50, 32]
mySquared = (num**2 for num in myNums)

for i in mySquared:
    print(i)
```

is valid code now even after compiling to Luau.

```lua
local myNums = {1, 90, 50, 32}
local mySquared = (function() local result = {} for num in myNums do table.insert(result, (num ^ 2)) end return result end)()
for i in mySquared do
    print(i)
end
```

Dictionary and List comprehension is also supported.
