Constants/Variables
Constant: Once assigned, the value cannot be re-assigned.
Literal constants: A single existing quantity that is not assigned to any variable or constant.
Variable: is a name, on the left side of the assignment symbol, that name can refer to the content to the right of the assignment symbol.
Example: i = 3
Except for spaces at the beginning of the line, other empty lines are meaningless.
Type System of variables
Python is the strongest type of language. (The different types can not be counted against each other, and the operation will be type checked)
Eg:4 + ' 4 ' returns the error.
Python is a dynamic language (meaning variables can be re-assigned to other types)
EG:I = 4 Type (i) return int
i = ' 4 ' type (i) returns STR
Basic types of Python
int \ float \ byte \ bool \ None
int integer (integer): Can be infinitely long and has no limit on length. A memory overflow occurs after the physical memory is fully occupied. Restricted to physical memory only.
Eg:4-1 1000
Float floating point (fractional): There is a length limit, and the precision is lost when there are a lot of decimal places.
eg:12.3 34.9 12.9
BOOL Type: True or False
None:none
Arithmetic operators
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>+-*///% * subtraction divisible Modulo exponentiation
Refers to the operation of our int and float.
Eg:1 + 1 =2
1 + 3.9 = 4.9
Not finished ...
Python basic syntax