Compare a Python list comprehension with an equivalent loop, and show that the comprehension is faster.
The two versions do the same job, and the comprehension is consistently quicker. The example below measures both of them with the same data, so you can see the difference on your own machine. The time module is the standard tool for measuring how long something takes, and perf_counter() is the clock that it uses.
import time
data = range(500_000)
start = time.perf_counter()
result = []
for value in data:
result.append(value * 2)
loop_seconds = time.perf_counter() - start
start = time.perf_counter()
fast = [value * 2 for value in data]
comp_seconds = time.perf_counter() - start
print('loop: ', round(loop_seconds, 4), 's')
print('comprehension:', round(comp_seconds, 4), 's')
print(len(result), len(fast))
Both versions produce the same 500,000 doubled values. The comprehension is usually around twice as fast on CPython, but the exact numbers depend on your machine and on your version of Python, so treat the output as a demonstration rather than as a figure to quote.
The reason for the difference is in the bytecode. A list comprehension compiles to a dedicated loop that the interpreter runs directly, while the explicit version runs a Python-level for statement whose body looks up the append method and calls it on every single pass. That repeated lookup is a large part of the difference.
That said, speed is not the reason to prefer comprehensions. Readability is the reason. The comprehension says in one expression what the code produces, while the loop spreads the same idea across three lines and leaves the reader to notice that the append is the only thing happening.
The honest caveat is that a comprehension is only clearer while it stays short. Once it needs a condition and a transformation and a nested loop, it becomes a dense line of brackets that is harder to scan than a loop with a named variable in it. The rule that works well is simple. Use a comprehension when it fits on one or two lines, and use a loop when it does not.