Python Principles
Python Q&A

What is the underscore variable for?

Answer:

Variable names may begin with an undercore, meaning that _ is a valid variable name. For example:

_ = 5
print(_)

It is customary to use _ as a variable name when the variable will never be used. For example, if you need to loop 10 times, you might write:

for i in range(10):
    print("stuff")

But here, i is never used. By instead naming it _, you can make it clear to others reading your code that the loop variable isn't ever used:

for _ in range(10):
    print("stuff")