How to calculate cubic power in python

Release: 2019-07-08 09:05:27
Original
33341 people have browsed it

How to calculate cubic power in python

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)
Copy after login

Running results

1 - c 的值为: 31
2 - c 的值为: 11
3 - c 的值为: 210
4 - c 的值为: 2.1
5 - c 的值为: 1
6 - c 的值为: 8
7 - c 的值为: 2
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!