mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
51 lines
742 B
Python
51 lines
742 B
Python
def test():
|
|
|
|
#算术运算符
|
|
a = 21
|
|
b = 10
|
|
c = 0
|
|
|
|
c = a + b
|
|
print("1 - c 的值为:")
|
|
print(c)
|
|
|
|
c = a - b
|
|
print("2 - c 的值为:")
|
|
print(c)
|
|
|
|
c = a * b
|
|
print("3 - c 的值为:")
|
|
print(c)
|
|
|
|
c = a / b
|
|
print("4 - c 的值为:")
|
|
print(c)
|
|
|
|
c = a % b
|
|
print("5 - c 的值为:")
|
|
print(c)
|
|
|
|
# 修改变量 a 、b 、c
|
|
a = 2
|
|
b = 3
|
|
c = a**b
|
|
print("6 - c 的值为:")
|
|
print(c)
|
|
|
|
a = 10
|
|
b = 5
|
|
c = a//b
|
|
print ("7 - c 的值为:")
|
|
print(c)
|
|
|
|
|
|
|
|
#比较运算符
|
|
a = 21
|
|
b = 10
|
|
c = 0
|
|
if a == b :
|
|
print ("1 - a 等于 b")
|
|
else:
|
|
print("1 - a 不等于 b")
|