-
demo03_赋值运算符
''' @note: https://www.runoob.com/python/python-operators.html @author: xilh @since: 20200124 ''' a = 21 b = 10 c = 0 c = a + b print("1. c 的值为:", c) c += a print("2. c 的值为:", c) c *= a print("3. c 的值为:", c) c /= a print("4. c 的值为:", c) c = 2 c %= a print("5. c 的值为:", c) c **= a print("6. c 的值为:", c) c //= a print("7. c 的值为:", c)
-
运行结果
1. c 的值为: 31 2. c 的值为: 52 3. c 的值为: 1092 4. c 的值为: 52.0 5. c 的值为: 2 6. c 的值为: 2097152 7. c 的值为: 99864