A variable ( This article uses python3.5):
#变量: is an area of computer memory where variables can store values within a specified range, and variables can change
There is no obvious type of variable #在python中变量是计算机内存中数据的引用 python, which is based on the actual data stored in the computer's memory. You can use type (variable name) to get the type of the variable
#在python中数据的存储是以值 (data), a numeric variable stored in the computer's memory is just a reference to the data
#DemoA=1;#a pointing in memory 1Print(ID (a));#address of the printed data 1497427760Print(a);#1a=2;#the point of a is re-specified. A points to memory 2Print(ID (a));#1497427792Print(a);#2#the same value (memory space) in Python can point to multiple variablesA=5;Print(ID (a));#1497427888B=5;Print(ID (b));#1497427888
Second, operator
########################### #算术运算符 ##########################Print(+);Print(3-2);Print(2*5);Print(4/2);Print(3/2);Print(3//2);#The divisible result is an integer (non-rounded integer)Print(17%6);#Take surplusPrint(3**2);#Square of 3Print(3**3);#Cubic of 3#The order of arithmetic operations is consistent with the order of operations in mathematics############################## #关系运算 Table Judging ####################################Print(1<2);#TruePrint(1>2);#FalsePrint(1!=2);#TruePrint(1==2);#FalsePrint(1==1.0);#True################################ #逻辑运算符 #####################################Print("######## #逻辑运算符 ############")Print(1>2 and2>3);#FalsePrint(1<2or2>3);#TruePrint( not1<2);#False
III. Basic data types
#Config=utf-8###################### #数据类型 ##############################shaping int integer floating-point (float) complex number (complex)num1=100;Print(Type (NUM1));#<class ' int ' > before python3.0 result is <type ' int ' >num2=99999999999999999999999999999999999999999;Print(Type (num2));#<class ' int ' > python3.5 before python3.0 <type ' long ' >f1=9.0;Print(Type (F1));#<class ' float ' >f2=3.14j;Print(Type (F2));#<class ' complex ' >#Character TypeStr="123";Print(Type (str));#<class ' str ' >str1="Let ' s go";Print(STR1);#Let ' s goStr2="Let ' s \ "go\"";#Escape \Print(STR2);#Let ' s "Go"Mail="tom:\n hello \ n i am Jack";#line break \ nPrint(mail); Mail2="""tom:i am Jack Goodbye""";Print(MAIL2);#"" " record text Format
Python Learning variables operations and basic data types