【python】运算符号(后续不断补充)

1、常规除 /

python 复制代码
#数学中的算法,带后面小数
print(3 / 2)

2、整除 //

python 复制代码
#去除小数部分,只留下整数
print(3 // 2)

3、求余 %

python 复制代码
#返回余数
print(15 % 11)

4、指数 **

python 复制代码
#用于计算一个数的指数
# b ** 2 : b的平方
# 2 ** 3 = 8
import math
a = -1
b = -2
c = 3
#求根公式
print((-b + math.sqrt(b**2 - 4*a*c)) / (2*a))
print((-b - math.sqrt(b**2 - 4*a*c)) / (2*a))
相关推荐
aqi003 小时前
15天学会AI应用开发(八)使用向量数据库实现RAG功能
人工智能·python·大模型·ai编程·ai应用
Csvn4 小时前
`functools.lru_cache` —— 一行代码搞定缓存加速
后端·python
金銀銅鐵21 小时前
[Python] 从《千字文》中随机挑选汉字
后端·python
cup111 天前
[技术复盘] Windows Python 打包实战:Nuitka 环境踩坑总结与 CI 自动化构建全指南
python·ai·环境变量·ci·nuitka·skill
aqi001 天前
15天学会AI应用开发(七)有了大模型为什么还要引入RAG
人工智能·python·大模型·ai编程·ai应用
金銀銅鐵1 天前
用 Python 实现 Take-Away 游戏
python·游戏
copyer_xyf1 天前
Agent 流程编排
后端·python·agent
copyer_xyf1 天前
Agent RAG
后端·python·agent