Skip to main content
 首页 » 编程设计

python之Python 中的指数语法

2025年05月04日27lonelyxmas

<分区>

我习惯用多种语言编写e^10。然而,每次在我短时间内编写 Python 时,我都会遇到这种类型错误:

TypeError: unsupported operand type(s) for ^: 'float' and 'int'

因为在 Python 中我们应该使用 **。是什么让 Python 选择该运算符而不是 ^,我认为在编程中更频繁地使用它,并且在我看来更自然。