Python Dates and Times in Python Let's Build a Timed Quiz App The Quiz Class

Ashley Keeling
Ashley Keeling
11,476 Points

underscore in python, for loops

is the underscore for when people look at the code or for python, or for both

1 Answer

Stuart Wright
Stuart Wright
41,091 Points

That's just a convention which shows the human reading the code that you never intend to access the value stored by that variable. So in the video, he just wants his code to repeat something 10 times, but he doesn't care which number _ is at any point. He could have used for i in range(10) and it would still have worked, but usually you'd only do that if you needed to access i.