The power operation in Python can be represented by **, and the cubic power in Python can be represented as x**3, which is the third power of x.
** is the arithmetic operator in Python that represents power operation. The arithmetic operators in Python include addition, subtraction, multiplication, division, modulo, and integer division.
Running example:
#!/usr/bin/python3 a = 21 b = 10 c = 0 c = a + b print ("1 - c 的值为:", c) c = a - b print ("2 - c 的值为:", c) c = a * b print ("3 - c 的值为:", c) c = a / b print ("4 - c 的值为:", c) c = a % b print ("5 - c 的值为:", c) # 修改变量 a 、b 、c a = 2 b = 3 c = a**b print ("6 - c 的值为:", c) a = 10 b = 5 c = a//b print ("7 - c 的值为:", c)
Running results
1 - c 的值为: 31 2 - c 的值为: 11 3 - c 的值为: 210 4 - c 的值为: 2.1 5 - c 的值为: 1 6 - c 的值为: 8 7 - c 的值为: 2
For more Python-related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of How to calculate cubic power in python. For more information, please follow other related articles on the PHP Chinese website!