
Available under Creative Commons-NonCommercial-ShareAlike 4.0 International License.
A statement is a unit of code that the Python interpreter can execute. We have seen two kinds of statements: print and assignment.
When you type a statement in interactive mode, the interpreter executes it and displays the result, if there is one.
A script usually contains a sequence of statements. If there is more than one statement, the results appear one at a time as the statements execute.
For example, the script
print 1x = 2 print x
produces the output
12
The assignment statement produces no output.
- 瀏覽次數:1711