01 arithmetic operators, comparison operators

Operator # ### 
 
 
# (1) arithmetic operators: + - * / // **% 
var1 = 10 
var2. 7 = 
# + 
RES = var1 var2 + 
Print (RES) 
 
# - 
RES = var1 -var2 
Print (RES ) # 3 
 
# * 
RES * = var1 var2 
Print (RES) # 70 
 
# / the end result must be a decimal 
RES = 14/7 
Print (RES) # 
 
# // floor after the divisor divisible 
RES = 14 // 7 
# If the dividend or the divisor is a decimal, the result followed by one of .0 
RES. 7 = 14.3 // 
Print (RES) 
 
#% 
RES # =. 8. 3% normal take the remainder 
RES # = -2. 3% -8 + =. 3. 1 
RES # -3. 8% 2 = + (-3) = -1 
RES # = -8 -3 -5% if their symbols are then directly take the remainder symbol, followed by a minus sign 
Print (RES) 
 
# ** 
RES = 2 **. 3 
RES = 2. 4 **
Print (RES)
# !=
 
 
# (2) comparison operators:> <> = <= = ==! 
"" "Returns a boolean value False True" "" 
#> 
var1 =. 5 
var2. 3 = 
RES = var1> var2 
Print (RES) 
 
# < 
RES = var1 <var2 
Print (RES) 
 
#> = 
RES = var1> = var2 
RES. 5 => # =. 5 to satisfy a condition returns true square 
Print (RES) 
 
# <= 
RES = var1 <var2 = 
RES =. 5 <= # 5 to satisfy a condition returns true square 
Print (RES) 
 
# == 
RES = var1 var2 == 
Print (RES) 
"" " 
# extra attention 
IF var1 var2 ==: 
    Print (123) 
IF = var1 var2: # assignment operator 
    Print (345) 
 
0 0.0 0j False ''() [] set() dict() None
"""
 
res = var1 != var2
print(res)

  

Guess you like

Origin www.cnblogs.com/eliwen/p/10968226.html