demo01_算术运算符

  • 算术运算符
'''
@note: https://www.runoob.com/python/python-operators.html
@author: xilh
@since: 20200124
'''

a = 21
b = 10
c = 0
 
c = a + b
print("a + b 的值为:", c)
 
c = a - b
print("a - b 的值为:", c)
 
c = a * b
print("a * b 的值为:", c)
 
c = a / b
print("a / b 的值为:", c)
 
c = a % b
print("a % b 的值为:", c)
 
# 修改变量 a 、b 、c
a = 2
b = 3
c = a**b 
print("a**b  的值为:", c)
 
a = 10
b = 5
c = a//b 
print("a//b  的值为:", c)
  • 运行结果
a + b 的值为: 31
a - b 的值为: 11
a * b 的值为: 210
a / b 的值为: 2.1
a % b 的值为: 1
a**b  的值为: 8
a//b  的值为: 2

 

posted @ 2020-01-28 12:20  xiluhua  阅读(185)  评论(0编辑  收藏  举报