0
why name-123 is not consider as a variable name ?
why should we use _ instant of - ?
2 Answers
+ 7
Minus sign is an operator and the interpreter treats it as subtraction symbol right away. So it understands you want to subtract one value from another, and gets confused if it's not true.
+ 1
That name wont work because it has a character that's not a letter, underscore or number. That's one of the rules in Python, variable names mustn't start with a number and can contain only letters, numbers and underscores, otherwise, an error occurs.