+ 1
Why we use _ in python?
2 odpowiedzi
+ 2
you cannot define a variable with space.
x y=5 #its wrong
but
x_y=5 #its right.
it's also use for if you want to define a variable with a name which is already built in function in python.
e.g
sum=4 #wrong because sum is built in function in python.
_sum=4 #right
it's also use in oop to tell the another programmer that this variable or function is private don't touch it.
_y=10 or def _h(): #private remember it's just convention to tell the another programmer but actual it is not a private.