+ 1
Why name " A-VARIABLE-NAME" is legal name in phythin
2 Antworten
+ 3
You aren't supposed to make use of any special characters other than underscore (_).
Be sure to keep the following variable rules in mind:
•Variable names can contain only letters, numbers, and underscores. They can start with a letter or an underscore, but not with a number.
For instance, you can call a variable message_1 but not 1_message.
•Spaces are not allowed in variable names, but underscores can be used to separate words in variable names.
For example, "greeting_message" works, but "greeting message" will cause errors.
•Avoid using Python keywords and function names as variable names; that is, do not use words that Python has reserved for a particular programmatic purpose, such as the word print.
•Variable names should be short but descriptive. For example, name is better than n, student_name is better than s_n, and name_length is better than length_of_persons_name.
+ 1
Thanks