Question on syntax / meaning

In the wrap-up quizz of Module 1, there is this instruction:

target = (target > 200_000).astype(int)

What does the underscore do? When I execute the instruction without the “_”, it gives the same result.

1 Like

The underscore is just here for readability, it’s a feature that appeared in Python 3.6 to group digits just like you would when writing them down by hand. It makes for easier reading of large numbers by the programmer, but has no effect during code execution:
https://docs.python.org/3.9/reference/lexical_analysis.html#integers

1 Like