Turtle cartography :https://blog.csdn.net/qq_61206761/article/details/122583246
Stack memory and heap memory :id-> Address type-> type value-> value
identifier : Alphanumeric underline ( Cannot start with a number )
Don't use keywords ( as follows ):
False class from or
None continue global pass
True def if raise
and del import return
as elif in try
assert else is while
async except lambda with
await finally nonlocal yield
break for not
Basic operators :
+,-,*,( Floating point division )/,( Integer division )//,%,( Exponentiation )**
Tips:1. Integer and floating point operations = Floating point numbers
2.divmod(a,b)= Quotient and remainder
Binary system :0b or 0B
octal :0o or 0O
Hexadecimal :0x or 0X
Forced type conversion (int):
Strings can only convert numeric strings .
int(3.54)=3
round(3.54)=4
Comparison operator :
==,!=,>,<,>=,<=
Logical operators :
or: x or y x by True, It doesn't count y, Go straight back to True;x by False, Then return to y
and:x and y x by True, Then return to y;x by False, It doesn't count y, Go straight back to False
not:not x It means No x
The same operator :
is: a is b if a and b Of id identical , return True; If different , return False
is not:a is not b if a and b Of id identical , return False; If different , return True
Tips:1.== The judgment is value Are they the same?
2.Python Cache only small integer objects ( The scope is [-5, 256]) cached , Not all integer objects . It should be noted that , This is just executed on the command line , And in the Pycharm Or other compilers or save it as a file , The result is different , This is because the interpreter does some optimization ( The scope is [-5, Arbitrary positive integer ]).