9月 222020
 
#Python算数运算符
a = 10
b = 15
# + 加
print('a + b =', a + b)
# - 减
print('a - b =', a - b)
# * 乘
print('a * b =', a * b)
# / 除
print('a / b =', a / b)
print('b / a =', b / a)
# % 取模,返回出除法的余数,余数为5
print('b % a =', b % a)
# ** 冥,返回x的y次方
print('a ** b =', a ** b)
# // 取整除,除法返回商的向下取整
print('b // a =', b // a)
print('16 // 7 =', 16 // 7)
PS C:\Users\harveymei> & C:/Users/harveymei/AppData/Local/Programs/Python/Python38/python.exe c:/Users/harveymei/hello.py
a + b = 25
a - b = -5
a * b = 150
a / b = 0.6666666666666666
b / a = 1.5
b % a = 5
a ** b = 1000000000000000
b // a = 1
16 // 7 = 2
PS C:\Users\harveymei>

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据