1. Why does python not need variable name and variable type declaration?
In python, the object type and memory are determined at runtime. When a value is created, the interpreter determines the type of the new object based on the syntax and the right operand.
2. Why does python not need to declare function types?
To be supplemented
3. Why should I avoid double underscores (_) at the beginning and end of the variable name in python?
Legal identifier:
-The first character must be a letter or underscore (_).
-The remaining characters can contain letters, numbers, and underscores.
-Case Sensitive
Python uses underlines as the prefix and suffix of variables to pin special variables.
-_ Xxx _ system definition name
-_ Xxx is not imported from 'from module import' or from module
-The private variable name module in the _ xxx class is not available except the class.
4. How does python write multiple statements in one row?
Multiple statements written in the same row of books are separated by a comma.
Example: import sys; x = 'foo'; sys. stdout. write (x + '\ n ')
Writing a single row of books greatly reduces readability and is not recommended.
5. How to Write multiple lines of books in the same python statement?
If the statement is too long, you can use the Backslash "\" to break it into several lines.
Example: if (a = 1) and \
(B = 0 ):
In exceptional cases, when the closed operator is used, a single statement can span multiple rows.
For example, you can write multiple lines of books in brackets, Parentheses, and curly brackets.
When assigning values to variables:
A. B. c. d = (1,
2, 3, 4)
Display a string with three quotation marks
Printf ''' aaaaaaaaaaaaaaaaaaaa
Aaaaaaaaaaaa '''
6. Variable assignment exercise
(A) values of x, y, z = 1, 2, 3 x, y, and z are obtained respectively.
& Gt; x 1
& Gt; y 2
& Gt; z 3
(B) What are the values of z, x, y = y, z, x, x, y, and z after execution?
& Gt; x 3
& Gt; y 1
& Gt; z 2
From the nevasun Column