a=1 b=2 print(a+b) print(a-b)
运行结果:
a=(45-5*6)/4 print(a) b=9/5 print(b)
运行结果:
''' /返回为float //返回整数 %返回余数 ''' a=18/3 print(a) b=17//3 print(b) c=5*3+2 print(c)
运行结果:
'''幂运算 **''' a=2**2 b=2**3 print(a,b)
运行结果:
x=6 print(x)
运行结果:
x = 5 x += 3 print(x)
运行结果:
x = 5 x = x+3 print(x)
运行结果:
x = 5 x = x-3 print(x)
运行结果:
x = 5 x -= 3 print(x)
运行结果:
x *= 3 等效 x = x * 3 print(x) x /= 3等效 x = x / 3 print(x) x %= 3 等效 x = x % 3 print(x) x //= 3 等效 x = x // 3 print(x) x **= 3 等效 x = x ** 3 print(x) x &= 3 等效 x = x & 3 print(x) x |= 3 等效 x = x | 3 print(x) x ^= 3 等效 x = x ^ 3 print(x) x >>= 3 等效x = x >> 3 print(x) x <<= 3 等效x = x << 3 print(x)