1:实数运算
1 # + 2 >>> 1 + 2 3 3 4 >>> 1.0 + 2 5 3.0 6 >>> 1.0 + 2.0 7 3.0 8 >>> 1 + 2.0 9 3.0 10 # - 11 >>> 1 -1.0 12 0.0 13 >>> 1.0-1 14 0.0 15 >>> 1 - 0.0 16 1.0 17 >>> 1 -0 18 1 19 # * 20 >>> 1*2 21 2 22 >>> 2 * 0.5 23 1.0 24 >>> 2.0 * 5 25 10.0 26 # / // 27 >>> 1 / 2 28 0 29 >>> 1 // 2 #取整运算符// 30 0 31 >>> 1.0 / 2 32 0.5 33 >>> 1.0 // 2 34 0.0 35 >>> 1 // 3 36 0 37 >>> 1 / 3 38 0 39 >>> 1.0 / 3 40 0.3333333333333333 41 >>> 1.0 // 3 42 0.0 43 # % 44 >>> 1 % 3 45 1 46 >>> 1 % 3.0 47 1.0 48 >>> 1.0 % 3 49 1.0 50 >>>
2:字符串运算
字符串和字符串
1 >>> ‘123‘+ "456" 2 ‘123456‘
字符串和实数(整数和浮点数)
3:Other
时间: 2024-11-07 06:58:35