forIntermediate Playground

Starts a loop that iterates over a sequence or iterable

Python Playground
Output
Click "Run" to execute your code

Comprehensions are syntactic sugar for common for-loop-and-append patterns. They are often faster because the append is optimized internally.

Challenge

Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?