# 加法运算符
m = 10
n = 97
sum1 = m + n
x = 7.2
y = 15.3
sum2 = x + y
print("sum1 = %d, sum2 = %.2f" %(sum1, sum2))
print()
## 拼接字符串
name = "C语言中文网"
url = "http://c.biancheng.net/"
age = 8
info = name + "的网址是" + url + ",它已经" + str(age) + "岁了。"
print(info)
print()
# 减法运算符
n = 45
m = -n
x = -83.5
y = -x
print(m, ",", y)
print()
## 求负
n = 45
n_neg = -n
f = -83.5
f_neg = -f
print(n_neg, ",", f_neg)
print()
# 乘法运算符
n = 4 * 25
f = 34.5 * 2
print(n, ",", f)
## 重复字符
str1 = "hello "
print(str1 * 4)
print()
# 除法运算符
# 整数不能除尽
print("23 / 5 = ", 23 / 5)
print("23 // 5 = ", 23 // 5)
print("23.0 // 5 = ", 23.0 // 5)
print("----------------")
# 整数能除尽
print("25 / 5 = ", 25 / 5)
print("25 // 5 = ", 25 // 5)
print("25.0 // 5 = ", 25.0 // 5)
print("----------------")
# 小数除法
print("12.4 / 3.5 = ", 12.5 / 3.5)
print("12.4 // 3.5 = ", 12.4 // 3.5)
print()
# 求余运算符
print("--------整数求余--------")
print("15 % 6 = ", 15 % 6)
print("-15 % 6 = ", -15 % 6)
print("15 % -6", 15 % -6)
print("-15 % -6 =", -15 % -6)
print("--------小数求余--------")
print("7.7 % 2.2 = ", 7.7 % 2.2)
print("-7.7 % 2.2 = ", -7.7 % 2.2)
print("7.7 % -2.2 = ", 7.7 % -2.2)
print("-7.7 % -2.2 = ", -7.7 % -2.2)
print("--------整数和小数求余--------")
print("23.5 % 6 = ", 23.5 % 6)
print("23 % 6.5 = ", 23 % 6.5)
print("23.5 % -6 = ", 23.5 % -6)
print("-23 % 6.5 = ", -23 % 6.5)
print("-23 % -6.5 = ", -23 % -6.5)
print()
# 次方(乘方)运算符
print("--------次方运算--------")
print("3 ** 4 = ", 3 ** 4)
print("2 ** 5 = ", 2 ** 5)
print("----开方运算--------")
print("81 ** (1 / 4) = ", 81 ** (1 / 4))
print("32 ** (1 / 5) = ", 32 ** (1 / 5))
没有合适的资源?快使用搜索试试~ 我知道了~
python有趣的库pb03-var-type.rar
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共21个文件
py:21个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
需积分: 5 0 下载量 124 浏览量
2024-06-27
07:44:59
上传
评论
收藏 7KB RAR 举报
温馨提示
python有趣的库pb03_var_type.rar
资源推荐
资源详情
资源评论
![whl](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rpm](https://img-home.csdnimg.cn/images/20210720083646.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rpm](https://img-home.csdnimg.cn/images/20210720083646.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![rpm](https://img-home.csdnimg.cn/images/20210720083646.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 21 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/bd8e81bf695a4d6eaba102823eb54b56_qq_66544550.jpg!1)
蜡笔小流
- 粉丝: 23
- 资源: 57
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)