pow()
pow(x,y) returns x raised to the power of y ( input numbers ) .
Here are some examples with different type of numbers.
import math
print(math.pow(2,3)) # 8.0
print(math.pow(2,-3)) # 0.125
print(math.pow(-2,-3)) # -0.125
print(math.pow(-2,3)) # -8.0
Using floats
import math
print(math.pow(2.2,3)) # 10.648000000000003
print(math.pow(2.2,-3)) # 0.09391435011269719
x is negative, and y is not an integer then pow(x, y) is undefined and raise ValueError.
print(math.pow(-2,3.3))
print(math.pow(-2,3.3))
Above code will generate error
« floor() & ceil()
modf() powm1()
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com