1. 使用 ` ` 运算符:
```python
result = 2 3 计算2的3次方
print(result) 输出结果为8
2. 使用 `pow()` 函数:
```python
import math
result = math.pow(2, 3) 计算2的3次方
print(result) 输出结果为8
3. 使用 `math.pow()` 函数(需要导入 `math` 模块):
```python
import math
result = math.pow(2, 3) 计算2的3次方
print(result) 输出结果为8
4. 计算n次方根(使用 ` ` 运算符):
```python
result = 2 0.5 计算2的0.5次方,即开平方
print(result) 输出结果为1.30951
5. 计算n次方根(使用 `math.sqrt()` 函数,需要导入 `math` 模块):
```python
import math
result = math.sqrt(2) 计算2的0.5次方,即开平方
print(result) 输出结果为1.30951
6. 使用 `math.pow()` 函数计算n次方根:
```python
import math
result = math.pow(2, 0.5) 计算2的0.5次方,即开平方
print(result) 输出结果为1.30951
以上方法适用于正整数指数的次方计算。如果需要计算负指数或复数次方,可以使用 ` ` 运算符或 `pow()` 函数,并相应地调整指数值。