num + = 1 is equivalent to num = num + 1
Num-= 2 is equivalent to num = num-2
Num *= 3 equivalent to num = num * 3
Num/= 5 is equivalent to num = NUM/5
Num//= 7 equivalent to num = num//7
Num%= 8 equivalent to num = num% 8
Num **= 9 equivalent to num = num * * 9
or and False Print (Luoji) # first, and then in the arithmetic Or,and the higher priority Result: True
logical Operators
List1 = [1,2,3,4,5,18,32,16]a= 10b= 32ifA not inchList1:Print("correct,%s is not in%s"%(a,list1))Else: Print("wrong,%s is not in%s"%(a,list1))ifBinchList1:Print("correct,%s is in%s"%(b, List1))Else: Print("wrong,%s is not in%s"%(b, List1)) results: Correct,10 is not inch[1, 2, 3, 4, 5, 18, 32, 16]correct,32 is inch[1, 2, 3, 4, 5, 18, 32, 16]
member Operators
#identity operators are notA = 10b= 32ifA isB:Print("correct,%s is%s"%(A, b))ifA is notB:Print("correct,%s is not%s"%(b)) a= 10b= 10ifA isB:Print("correct,%s is%s"%(A, b))ifA is notB:Print("correct,%s is not%s"%(b)) results: Correct,10 is not32correct,10 is10
identity operator
Python basic 4 commonly used operators