正文

编写一个函数来计算n的值取决于你想要计算的是什么。以下是一些常见的数学函数,以及它们的Python实现: 1. **计算n的平方**: ```python def square(n): return n * n ``` 2. **计算n的立方**: ```python def cube(n): return n * n * n ``` 3.