underscore variable

The name _, used by convention for a value you must receive but will never use, as in for _ in range(3).

In more detail

Python treats _ as an ordinary name; the underscore only tells readers that the value is deliberately ignored. In the interactive shell _ also holds the last result shown.

Example

for _ in range(3):
    print("Hip hip hooray!")

Related terms

Taught in

References

Certification courses